• Skip to secondary menu
  • Skip to main content
  • Skip to primary sidebar

Python and R Tips

Learn Data Science with Python and R

  • Home
  • Python
  • Pandas
    • Pandas 101
  • tidyverse
    • tidyverse 101
  • R
  • Linux
  • Conferences
  • Python Books
  • About
    • Privacy Policy
You are here: Home / Archives for Pandas Data Frame

Pandas Data Frame

3 Ways to Add New Columns to Pandas Dataframe?

January 26, 2019 by cmdlinetips

How To Add New Column in Pandas?

While doing data wrangling or data manipulation, often one may want to add a new column or variable to an existing Pandas dataframe without changing anything else. Obviously the new column will have have the same number of elements. Let us see examples of three ways to add new columns to a Pandas data frame. […]

Filed Under: Add New Columns Pandas, Pandas DataFrame Tagged With: Add New Column in Pandas, Pandas Data Frame

How to Collapse Multiple Columns in Pandas? Groupby with Dictionary

September 15, 2018 by cmdlinetips

Collapse columns with Groupby and Dictionary

Often you may want to collapse two or multiple columns in a Pandas data frame into one column. For example, you may have a data frame with data for each year as columns and you might want to get a new column which summarizes multiple columns. One may need to have flexibility of collapsing columns […]

Filed Under: groupby, Pandas DataFrame, Python Tagged With: Pandas Collapse Columns, Pandas Combine Columns, Pandas Data Frame

How To Split A Column or Column Names in Pandas and Get Part of it?

June 15, 2018 by cmdlinetips

Often you may want to create a new variable either from column names of a pandas data frame or from one of the columns of the data frame. Just like Python, Pandas has great string manipulation abilities that lets you manipulate strings easily. Let us see an example of using Pandas to manipulate column names […]

Filed Under: Pandas DataFrame, Python Tips Tagged With: get part of column in Pandas, Pandas Data Frame, Split Column Names of Pandas Dataframe

How to Get Unique Values from a Column in Pandas Data Frame?

January 31, 2018 by cmdlinetips

In this tutorial, we will learn how to get unique values of a column in a Pandas dataframe using two approaches. We will first use Pandas unique() function to get unique values of a column and then use Pandas drop_duplicates() function to get unique values of a column. Pandas unique() function To Get Unique values […]

Filed Under: Pandas DataFrame, Python, Python Tips Tagged With: Pandas Data Frame, Pandas drop_duplicates(), Pandas unique(), Python Tips, Unique Values Pandas, uniques values in a column pandas

How To Add a New Column Using a Dictionary in Pandas Data Frame ?

January 28, 2018 by cmdlinetips

Creating a new column to a dataframe is a common task in doing data analysis. And this task often comes in a variety of forms. Earlier we saw how to add a column using an existing columns in two ways. In this post we will learn how to add a new column using a dictionary […]

Filed Under: Pandas DataFrame, Pandas map function, Python Tips Tagged With: Pandas Data Frame, Pandas map function, Python Tips

  • Page 1
  • Page 2
  • Go to Next Page »

Primary Sidebar

Subscribe to Python and R Tips and Learn Data Science

Learn Pandas in Python and Tidyverse in R

Tags

Altair Basic NumPy Book Review Data Science Data Science Books Data Science Resources Data Science Roundup Data Visualization Dimensionality Reduction Dropbox Dropbox Free Space Dropbox Tips Emacs Emacs Tips ggplot2 Linux Commands Linux Tips Mac Os X Tips Maximum Likelihood Estimation in R MLE in R NumPy Pandas Pandas 101 Pandas Dataframe Pandas Data Frame pandas groupby() Pandas select columns Pandas select_dtypes Python Python 3 Python Boxplot Python Tips R rstats R Tips Seaborn Seaborn Boxplot Seaborn Catplot Shell Scripting Sparse Matrix in Python tidy evaluation tidyverse tidyverse 101 Vim Vim Tips

RSS RSS

  • How to convert row names to a column in Pandas
  • How to resize an image with PyTorch
  • Fashion-MNIST data from PyTorch
  • Pandas case_when() with multiple examples
  • An Introduction to Statistical Learning: with Applications in Python Is Here
  • 10 Tips to customize ggplot2 title text
  • 8 Plot types with Matplotlib in Python
  • PCA on S&P 500 Stock Return Data
  • Linear Regression with Matrix Decomposition Methods
  • Numpy’s random choice() function

Copyright © 2025 · Lifestyle Pro on Genesis Framework · WordPress · Log in

Go to mobile version