Ad

Thursday, March 29, 2018

Python Pandas Data Science Manipulation Pandas Cheat Sheet

pandas.Series = (
 {key : value}
)

pandas.DataFrame  = (
{key : value},
{key : value},
{key : value},
index=[]
)

Add new column
pandas.DataFrame['col_name'] = value

     value can be a series of vectors or dictionary
     pd.Series({0:'first', 1:'second'})



placeholder strategy
df['feedback'] = ['+', None, '-']

turn index into auto incrementing default numbers
guaranteed unique
df.reset_index()


join dataframes

Pandas data types http://pandas.pydata.org/pandas-docs/stable/basics.html#dtypes

df.to_csv() export dataframe as csv

data = pd.read_csv("data.csv", sep = '\t', nrows = nrows)

No comments:

Post a Comment

Developing apps for airtable using Airtable Blocks

The airtable smart sheets now has an app platform called Airtable Blocks, which allows developers to add custom code, and build apps quickly...