SlideShare a Scribd company logo
2
Most read
F M A
Data Wrangling
with pandas
Cheat Sheet
http://pandas.pydata.org
Syntax – Creating DataFrames
Tidy Data – A foundation for wrangling in pandas
In a tidy
data set:
F M A
Each variable is saved
in its own column
&Each observation is
saved in its own row
Tidy data complements pandas’s vectorized
operations. pandas will automatically preserve
observations as you manipulate variables. No
other format works as intuitively with pandas.
Reshaping Data – Change the layout of a data set
M A F
*
M A*
pd.melt(df)
Gather columns into rows.
df.pivot(columns='var', values='val')
Spread rows into columns.
pd.concat([df1,df2])
Append rows of DataFrames
pd.concat([df1,df2], axis=1)
Append columns of DataFrames
df.sort_values('mpg')
Order rows by values of a column (low to high).
df.sort_values('mpg',ascending=False)
Order rows by values of a column (high to low).
df.rename(columns = {'y':'year'})
Rename the columns of a DataFrame
df.sort_index()
Sort the index of a DataFrame
df.reset_index()
Reset index of DataFrame to row numbers, moving
index to columns.
df.drop(columns=['Length','Height'])
Drop columns from DataFrame
Subset Observations (Rows) Subset Variables (Columns)
a b c
1 4 7 10
2 5 8 11
3 6 9 12
df = pd.DataFrame(
{"a" : [4 ,5, 6],
"b" : [7, 8, 9],
"c" : [10, 11, 12]},
index = [1, 2, 3])
Specify values for each column.
df = pd.DataFrame(
[[4, 7, 10],
[5, 8, 11],
[6, 9, 12]],
index=[1, 2, 3],
columns=['a', 'b', 'c'])
Specify values for each row.
a b c
n v
d
1 4 7 10
2 5 8 11
e 2 6 9 12
df = pd.DataFrame(
{"a" : [4 ,5, 6],
"b" : [7, 8, 9],
"c" : [10, 11, 12]},
index = pd.MultiIndex.from_tuples(
[('d',1),('d',2),('e',2)],
names=['n','v']))
Create DataFrame with a MultiIndex
Method Chaining
Most pandas methods return a DataFrame so that
another pandas method can be applied to the
result. This improves readability of code.
df = (pd.melt(df)
.rename(columns={
'variable' : 'var',
'value' : 'val'})
.query('val >= 200')
)
df[df.Length > 7]
Extract rows that meet logical
criteria.
df.drop_duplicates()
Remove duplicate rows (only
considers columns).
df.head(n)
Select first n rows.
df.tail(n)
Select last n rows.
Logic in Python (and pandas)
< Less than != Not equal to
> Greater than df.column.isin(values) Group membership
== Equals pd.isnull(obj) Is NaN
<= Less than or equals pd.notnull(obj) Is not NaN
>= Greater than or equals &,|,~,^,df.any(),df.all() Logical and, or, not, xor, any, all
http://pandas.pydata.org/ This cheat sheet inspired by Rstudio Data Wrangling Cheatsheet (https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf) Written by Irv Lustig, Princeton Consultants
df[['width','length','species']]
Select multiple columns with specific names.
df['width'] or df.width
Select single column with specific name.
df.filter(regex='regex')
Select columns whose name matches regular expression regex.
df.loc[:,'x2':'x4']
Select all columns between x2 and x4 (inclusive).
df.iloc[:,[1,2,5]]
Select columns in positions 1, 2 and 5 (first column is 0).
df.loc[df['a'] > 10, ['a','c']]
Select rows meeting logical condition, and only the specific columns .
regex (Regular Expressions) Examples
'.' Matches strings containing a period '.'
'Length$' Matches strings ending with word 'Length'
'^Sepal' Matches strings beginning with the word 'Sepal'
'^x[1-5]$' Matches strings beginning with 'x' and ending with 1,2,3,4,5
'^(?!Species$).*' Matches strings except the string 'Species'
df.sample(frac=0.5)
Randomly select fraction of rows.
df.sample(n=10)
Randomly select n rows.
df.iloc[10:20]
Select rows by position.
df.nlargest(n, 'value')
Select and order top n entries.
df.nsmallest(n, 'value')
Select and order bottom n entries.
Summarize Data
Make New Columns
Combine Data Sets
df['w'].value_counts()
Count number of rows with each unique value of variable
len(df)
# of rows in DataFrame.
df['w'].nunique()
# of distinct values in a column.
df.describe()
Basic descriptive statistics for each column (or GroupBy)
pandas provides a large set of summary functions that operate on
different kinds of pandas objects (DataFrame columns, Series,
GroupBy, Expanding and Rolling (see below)) and produce single
values for each of the groups. When applied to a DataFrame, the
result is returned as a pandas Series for each column. Examples:
sum()
Sum values of each object.
count()
Count non-NA/null values of
each object.
median()
Median value of each object.
quantile([0.25,0.75])
Quantiles of each object.
apply(function)
Apply function to each object.
min()
Minimum value in each object.
max()
Maximum value in each object.
mean()
Mean value of each object.
var()
Variance of each object.
std()
Standard deviation of each
object.
df.assign(Area=lambda df: df.Length*df.Height)
Compute and append one or more new columns.
df['Volume'] = df.Length*df.Height*df.Depth
Add single column.
pd.qcut(df.col, n, labels=False)
Bin column into n buckets.
Vector
function
Vector
function
pandas provides a large set of vector functions that operate on all
columns of a DataFrame or a single selected column (a pandas
Series). These functions produce vectors of values for each of the
columns, or a single Series for the individual Series. Examples:
shift(1)
Copy with values shifted by 1.
rank(method='dense')
Ranks with no gaps.
rank(method='min')
Ranks. Ties get min rank.
rank(pct=True)
Ranks rescaled to interval [0, 1].
rank(method='first')
Ranks. Ties go to first value.
shift(-1)
Copy with values lagged by 1.
cumsum()
Cumulative sum.
cummax()
Cumulative max.
cummin()
Cumulative min.
cumprod()
Cumulative product.
x1 x2
A 1
B 2
C 3
x1 x3
A T
B F
D T
adf bdf
Standard Joins
x1 x2 x3
A 1 T
B 2 F
C 3 NaN
x1 x2 x3
A 1.0 T
B 2.0 F
D NaN T
x1 x2 x3
A 1 T
B 2 F
x1 x2 x3
A 1 T
B 2 F
C 3 NaN
D NaN T
pd.merge(adf, bdf,
how='left', on='x1')
Join matching rows from bdf to adf.
pd.merge(adf, bdf,
how='right', on='x1')
Join matching rows from adf to bdf.
pd.merge(adf, bdf,
how='inner', on='x1')
Join data. Retain only rows in both sets.
pd.merge(adf, bdf,
how='outer', on='x1')
Join data. Retain all values, all rows.
Filtering Joins
x1 x2
A 1
B 2
x1 x2
C 3
adf[adf.x1.isin(bdf.x1)]
All rows in adf that have a match in bdf.
adf[~adf.x1.isin(bdf.x1)]
All rows in adf that do not have a match in bdf.
x1 x2
A 1
B 2
C 3
x1 x2
B 2
C 3
D 4
ydf zdf
Set-like Operations
x1 x2
B 2
C 3
x1 x2
A 1
B 2
C 3
D 4
x1 x2
A 1
pd.merge(ydf, zdf)
Rows that appear in both ydf and zdf
(Intersection).
pd.merge(ydf, zdf, how='outer')
Rows that appear in either or both ydf and zdf
(Union).
pd.merge(ydf, zdf, how='outer',
indicator=True)
.query('_merge == "left_only"')
.drop(columns=['_merge'])
Rows that appear in ydf but not zdf (Setdiff).
Group Data
df.groupby(by="col")
Return a GroupBy object,
grouped by values in column
named "col".
df.groupby(level="ind")
Return a GroupBy object,
grouped by values in index
level named "ind".
All of the summary functions listed above can be applied to a group.
Additional GroupBy functions:
max(axis=1)
Element-wise max.
clip(lower=-10,upper=10)
Trim values at input thresholds
min(axis=1)
Element-wise min.
abs()
Absolute value.
The examples below can also be applied to groups. In this case, the
function is applied on a per-group basis, and the returned vectors
are of the length of the original DataFrame.
Windows
df.expanding()
Return an Expanding object allowing summary functions to be
applied cumulatively.
df.rolling(n)
Return a Rolling object allowing summary functions to be
applied to windows of length n.
size()
Size of each group.
agg(function)
Aggregate group using function.
Handling Missing Data
df.dropna()
Drop rows with any column having NA/null data.
df.fillna(value)
Replace all NA/null data with value.
Plotting
df.plot.hist()
Histogram for each column
df.plot.scatter(x='w',y='h')
Scatter chart using pairs of points
http://pandas.pydata.org/ This cheat sheet inspired by Rstudio Data Wrangling Cheatsheet (https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf) Written by Irv Lustig, Princeton Consultants

More Related Content

PPTX
Python-for-Data-Analysis.pptx
PDF
Data Analysis with Pandas CheatSheet .pdf
PDF
Python Pandas for Data Science cheatsheet
PDF
Python3 cheatsheet
PPTX
Introduction to numpy Session 1
PDF
Introduction to Pandas and Time Series Analysis [PyCon DE]
PPTX
getting started with numpy and pandas.pptx
PDF
pandas - Python Data Analysis
Python-for-Data-Analysis.pptx
Data Analysis with Pandas CheatSheet .pdf
Python Pandas for Data Science cheatsheet
Python3 cheatsheet
Introduction to numpy Session 1
Introduction to Pandas and Time Series Analysis [PyCon DE]
getting started with numpy and pandas.pptx
pandas - Python Data Analysis

What's hot (20)

PDF
Python matplotlib cheat_sheet
PPTX
KMP String Matching Algorithm
PPTX
Pandas
PDF
Cheat Sheet for Machine Learning in Python: Scikit-learn
PPTX
queue & its applications
PDF
Numpy python cheat_sheet
PPT
String matching with finite state automata
PDF
Pandas
PPTX
RABIN KARP ALGORITHM STRING MATCHING
PPTX
Rabin karp string matching algorithm
PDF
Python For Data Science Cheat Sheet
PDF
Python_ 3 CheatSheet
PPT
5.2 divide and conquer
PPTX
String matching algorithms(knuth morris-pratt)
PPTX
Java Foundations: Basic Syntax, Conditions, Loops
PPTX
Python pandas Library
PPTX
8 queens problem.pptx
PPTX
Bellman ford Algorithm
PPT
Sets and disjoint sets union123
Python matplotlib cheat_sheet
KMP String Matching Algorithm
Pandas
Cheat Sheet for Machine Learning in Python: Scikit-learn
queue & its applications
Numpy python cheat_sheet
String matching with finite state automata
Pandas
RABIN KARP ALGORITHM STRING MATCHING
Rabin karp string matching algorithm
Python For Data Science Cheat Sheet
Python_ 3 CheatSheet
5.2 divide and conquer
String matching algorithms(knuth morris-pratt)
Java Foundations: Basic Syntax, Conditions, Loops
Python pandas Library
8 queens problem.pptx
Bellman ford Algorithm
Sets and disjoint sets union123
Ad

Similar to Pandas Cheat Sheet (20)

PDF
pandas dataframe notes.pdf
PPTX
ppanda.pptx
PDF
Pandas,scipy,numpy cheatsheet
PPTX
Introduction to pandas
PPTX
Pandas Dataframe reading data Kirti final.pptx
PDF
pandas-221217084954-937bb582.pdf
PPTX
Pandas.pptx
PPTX
introductiontopandas- for 190615082420.pptx
PPTX
Pandas yayyyyyyyyyyyyyyyyyin Python.pptx
PPTX
Python Pandas.pptx
PPTX
Pandas-(Ziad).pptx
PPTX
introduction to data structures in pandas
PDF
lecture14DATASCIENCE AND MACHINE LER.pdf
PDF
Pandas in Depth_ Data Manipultion(Chapter 5)(Important).pdf
PPTX
Python Cheat Sheet Presentation Learning
PDF
SciPy 2011 pandas lightning talk
PPTX
DataStructures in Pyhton Pandas and numpy.pptx
PPTX
Group B - Pandas Pandas is a powerful Python library that provides high-perfo...
PPTX
Unit 1 Ch 2 Data Frames digital vis.pptx
PDF
Getting started with Pandas Cheatsheet.pdf
pandas dataframe notes.pdf
ppanda.pptx
Pandas,scipy,numpy cheatsheet
Introduction to pandas
Pandas Dataframe reading data Kirti final.pptx
pandas-221217084954-937bb582.pdf
Pandas.pptx
introductiontopandas- for 190615082420.pptx
Pandas yayyyyyyyyyyyyyyyyyin Python.pptx
Python Pandas.pptx
Pandas-(Ziad).pptx
introduction to data structures in pandas
lecture14DATASCIENCE AND MACHINE LER.pdf
Pandas in Depth_ Data Manipultion(Chapter 5)(Important).pdf
Python Cheat Sheet Presentation Learning
SciPy 2011 pandas lightning talk
DataStructures in Pyhton Pandas and numpy.pptx
Group B - Pandas Pandas is a powerful Python library that provides high-perfo...
Unit 1 Ch 2 Data Frames digital vis.pptx
Getting started with Pandas Cheatsheet.pdf
Ad

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
Transforming Manufacturing operations through Intelligent Integrations
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Modernizing your data center with Dell and AMD
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Advanced IT Governance
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
Transforming Manufacturing operations through Intelligent Integrations
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Modernizing your data center with Dell and AMD
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Monthly Chronicles - July 2025
Advanced IT Governance
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
MYSQL Presentation for SQL database connectivity
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication

Pandas Cheat Sheet

  • 1. F M A Data Wrangling with pandas Cheat Sheet http://pandas.pydata.org Syntax – Creating DataFrames Tidy Data – A foundation for wrangling in pandas In a tidy data set: F M A Each variable is saved in its own column &Each observation is saved in its own row Tidy data complements pandas’s vectorized operations. pandas will automatically preserve observations as you manipulate variables. No other format works as intuitively with pandas. Reshaping Data – Change the layout of a data set M A F * M A* pd.melt(df) Gather columns into rows. df.pivot(columns='var', values='val') Spread rows into columns. pd.concat([df1,df2]) Append rows of DataFrames pd.concat([df1,df2], axis=1) Append columns of DataFrames df.sort_values('mpg') Order rows by values of a column (low to high). df.sort_values('mpg',ascending=False) Order rows by values of a column (high to low). df.rename(columns = {'y':'year'}) Rename the columns of a DataFrame df.sort_index() Sort the index of a DataFrame df.reset_index() Reset index of DataFrame to row numbers, moving index to columns. df.drop(columns=['Length','Height']) Drop columns from DataFrame Subset Observations (Rows) Subset Variables (Columns) a b c 1 4 7 10 2 5 8 11 3 6 9 12 df = pd.DataFrame( {"a" : [4 ,5, 6], "b" : [7, 8, 9], "c" : [10, 11, 12]}, index = [1, 2, 3]) Specify values for each column. df = pd.DataFrame( [[4, 7, 10], [5, 8, 11], [6, 9, 12]], index=[1, 2, 3], columns=['a', 'b', 'c']) Specify values for each row. a b c n v d 1 4 7 10 2 5 8 11 e 2 6 9 12 df = pd.DataFrame( {"a" : [4 ,5, 6], "b" : [7, 8, 9], "c" : [10, 11, 12]}, index = pd.MultiIndex.from_tuples( [('d',1),('d',2),('e',2)], names=['n','v'])) Create DataFrame with a MultiIndex Method Chaining Most pandas methods return a DataFrame so that another pandas method can be applied to the result. This improves readability of code. df = (pd.melt(df) .rename(columns={ 'variable' : 'var', 'value' : 'val'}) .query('val >= 200') ) df[df.Length > 7] Extract rows that meet logical criteria. df.drop_duplicates() Remove duplicate rows (only considers columns). df.head(n) Select first n rows. df.tail(n) Select last n rows. Logic in Python (and pandas) < Less than != Not equal to > Greater than df.column.isin(values) Group membership == Equals pd.isnull(obj) Is NaN <= Less than or equals pd.notnull(obj) Is not NaN >= Greater than or equals &,|,~,^,df.any(),df.all() Logical and, or, not, xor, any, all http://pandas.pydata.org/ This cheat sheet inspired by Rstudio Data Wrangling Cheatsheet (https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf) Written by Irv Lustig, Princeton Consultants df[['width','length','species']] Select multiple columns with specific names. df['width'] or df.width Select single column with specific name. df.filter(regex='regex') Select columns whose name matches regular expression regex. df.loc[:,'x2':'x4'] Select all columns between x2 and x4 (inclusive). df.iloc[:,[1,2,5]] Select columns in positions 1, 2 and 5 (first column is 0). df.loc[df['a'] > 10, ['a','c']] Select rows meeting logical condition, and only the specific columns . regex (Regular Expressions) Examples '.' Matches strings containing a period '.' 'Length$' Matches strings ending with word 'Length' '^Sepal' Matches strings beginning with the word 'Sepal' '^x[1-5]$' Matches strings beginning with 'x' and ending with 1,2,3,4,5 '^(?!Species$).*' Matches strings except the string 'Species' df.sample(frac=0.5) Randomly select fraction of rows. df.sample(n=10) Randomly select n rows. df.iloc[10:20] Select rows by position. df.nlargest(n, 'value') Select and order top n entries. df.nsmallest(n, 'value') Select and order bottom n entries.
  • 2. Summarize Data Make New Columns Combine Data Sets df['w'].value_counts() Count number of rows with each unique value of variable len(df) # of rows in DataFrame. df['w'].nunique() # of distinct values in a column. df.describe() Basic descriptive statistics for each column (or GroupBy) pandas provides a large set of summary functions that operate on different kinds of pandas objects (DataFrame columns, Series, GroupBy, Expanding and Rolling (see below)) and produce single values for each of the groups. When applied to a DataFrame, the result is returned as a pandas Series for each column. Examples: sum() Sum values of each object. count() Count non-NA/null values of each object. median() Median value of each object. quantile([0.25,0.75]) Quantiles of each object. apply(function) Apply function to each object. min() Minimum value in each object. max() Maximum value in each object. mean() Mean value of each object. var() Variance of each object. std() Standard deviation of each object. df.assign(Area=lambda df: df.Length*df.Height) Compute and append one or more new columns. df['Volume'] = df.Length*df.Height*df.Depth Add single column. pd.qcut(df.col, n, labels=False) Bin column into n buckets. Vector function Vector function pandas provides a large set of vector functions that operate on all columns of a DataFrame or a single selected column (a pandas Series). These functions produce vectors of values for each of the columns, or a single Series for the individual Series. Examples: shift(1) Copy with values shifted by 1. rank(method='dense') Ranks with no gaps. rank(method='min') Ranks. Ties get min rank. rank(pct=True) Ranks rescaled to interval [0, 1]. rank(method='first') Ranks. Ties go to first value. shift(-1) Copy with values lagged by 1. cumsum() Cumulative sum. cummax() Cumulative max. cummin() Cumulative min. cumprod() Cumulative product. x1 x2 A 1 B 2 C 3 x1 x3 A T B F D T adf bdf Standard Joins x1 x2 x3 A 1 T B 2 F C 3 NaN x1 x2 x3 A 1.0 T B 2.0 F D NaN T x1 x2 x3 A 1 T B 2 F x1 x2 x3 A 1 T B 2 F C 3 NaN D NaN T pd.merge(adf, bdf, how='left', on='x1') Join matching rows from bdf to adf. pd.merge(adf, bdf, how='right', on='x1') Join matching rows from adf to bdf. pd.merge(adf, bdf, how='inner', on='x1') Join data. Retain only rows in both sets. pd.merge(adf, bdf, how='outer', on='x1') Join data. Retain all values, all rows. Filtering Joins x1 x2 A 1 B 2 x1 x2 C 3 adf[adf.x1.isin(bdf.x1)] All rows in adf that have a match in bdf. adf[~adf.x1.isin(bdf.x1)] All rows in adf that do not have a match in bdf. x1 x2 A 1 B 2 C 3 x1 x2 B 2 C 3 D 4 ydf zdf Set-like Operations x1 x2 B 2 C 3 x1 x2 A 1 B 2 C 3 D 4 x1 x2 A 1 pd.merge(ydf, zdf) Rows that appear in both ydf and zdf (Intersection). pd.merge(ydf, zdf, how='outer') Rows that appear in either or both ydf and zdf (Union). pd.merge(ydf, zdf, how='outer', indicator=True) .query('_merge == "left_only"') .drop(columns=['_merge']) Rows that appear in ydf but not zdf (Setdiff). Group Data df.groupby(by="col") Return a GroupBy object, grouped by values in column named "col". df.groupby(level="ind") Return a GroupBy object, grouped by values in index level named "ind". All of the summary functions listed above can be applied to a group. Additional GroupBy functions: max(axis=1) Element-wise max. clip(lower=-10,upper=10) Trim values at input thresholds min(axis=1) Element-wise min. abs() Absolute value. The examples below can also be applied to groups. In this case, the function is applied on a per-group basis, and the returned vectors are of the length of the original DataFrame. Windows df.expanding() Return an Expanding object allowing summary functions to be applied cumulatively. df.rolling(n) Return a Rolling object allowing summary functions to be applied to windows of length n. size() Size of each group. agg(function) Aggregate group using function. Handling Missing Data df.dropna() Drop rows with any column having NA/null data. df.fillna(value) Replace all NA/null data with value. Plotting df.plot.hist() Histogram for each column df.plot.scatter(x='w',y='h') Scatter chart using pairs of points http://pandas.pydata.org/ This cheat sheet inspired by Rstudio Data Wrangling Cheatsheet (https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf) Written by Irv Lustig, Princeton Consultants