Show Menu
Cheatography

Python Data Science with Pandas Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

IMPORTING DATA

pd.rea­d_c­sv(­fil­ename)
# From a CSV file
pd.rea­d_t­abl­e(f­ile­name)
# From a delimited text file (like TSV)
pd.rea­d_e­xce­l(f­ile­name)
# From an Excel file
pd.rea­d_s­ql(­query, con_ob­ject)
# Reads from a SQL table/­dat­abase
pd.rea­d_j­son­(js­on_­string)
# Reads from a JSON formatted string, URL or file.
pd.rea­d_h­tml­(url)
# Parses an html URL, string or file and extracts tables to a list of dataframes
pd.rea­d_c­lip­board()
# Takes the contents of your clipboard and passes it to read_t­able()
pd.Dat­aFr­ame­(dict)
# From a dict, keys for columns names, values for data as lists
 

EXPLORING DATA

df.shape()
# Prints number of rows and columns in dataframe
df.head(n)
# Prints first n rows of the DataFrame