Table of Contents

Pandas

Cheat Sheet

https://github.com/pandas-dev/pandas/tree/main/doc/cheatsheet

Display

pd.get_option('display.max_rows')
pd.get_option('display.max_columns')
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)

I/O

df = pd.read_csv('sample.csv')

Misc

df.replace({'n':0, 'y':1})
df[df['a'] == 'y'].sort_values(by='b')
df[(df['a'] == 'y') & (df['b'].notnull())].sort_values(by='c')
df.loc[df['a'] == 0, ['b']] = 1
df['a'].notnull() * 1

References