Skip to content

Instantly share code, notes, and snippets.

@sam-be
sam-be / pandas.py
Last active April 15, 2020 12:56 — forked from why-not/gist:4582705
[Assorted Pandas snippets] #pandas #forked #cheatsheet
"""making a dataframe"""
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
"""quick way to create an interesting data frame to try things out"""
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd'])
"""convert a dictionary into a DataFrame"""
"""make the keys into columns"""
df = pd.DataFrame(dic, index=[0])