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

No comments:

Post a Comment

Machine Learning Workflow

Data cleaning Missing data Outlier Others: duplicates, typos, special characters Strategy for missing data: imputation, mean, median...