Show Menu
Cheatography

Python: Pandas Cheat Sheet (DRAFT) by

From Colt Steele's course.

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

Dates and Time

pd.to_­dat­etime("3:­55:45 Apr. 2nd 90")
pd.rea­d_c­sv(­"­pat­h", parse_­dates=["da­te_­tim­e_c­ol"])
s.dt.year (quarter, month, day, hour, etc)
s.dt.hour (minute, second, etc)
s.dt.wee­kofyear (dayof­week, weekday, etc)
df["­dat­e_t­ime­"].dt.date
df["­dat­e_t­ime­"] > "­201­9-1­2-2­3"
df["­dat­e_t­ime­"].between("19­88", "­198­9")
 

Dataframes & Datasets

pd.rea­d_csv()
df.head()
df.tail()
df.info()

Basic DataFrame Methods

df.min()
df.max()
df.sum()
df.count()
df.mean()
df.med­ian()
df.mode()
df.des­cribe()

Series & Column

s.unique()
s.nuni­que()
s.nlar­gest()
s.nsma­llest()
s.valu­e_c­ounts()
s.plot()