/Pandas-Practice

Review and Practice the main topics of Pandas library

Primary LanguageJupyter Notebook

Pandas-Practice Contents

Read write display a dataframe

  • pd.read_csv()
  • pd.options.display.max_rows = 10
  • pd.DataFrame({'col1':[1,2,3], 'col2':[1,2,3]})
  • set_index
  • rename_axis

Basic data frame summary

  • df.shape
  • df.columns
  • df.dropna(axis=0)
  • df.describe()
  • df.loc
  • df.iloc
  • df.count()
  • df.head()

Data Frame vs. Series

Groupby

Merge

Misc

  • [index for index in aa if aa>1]
  • a={x: function(x) for x in range}, min(a,key=a.get)
  • plot label rotation Reference
  • datatime
  • scikit-learn library
    • from sklearn.tree import DecisionTreeRegressor
    • model = DecisionTreeRegressor(random_state=1)
    • model.fit(x,y)
    • model.predict(xxx)
    • from sklearn.metrics import mean_absolute_error
    • from sklearn.model_selection import train_test_split
  • print format
    • print("blah: %d" %dataname)
    • print("blah: {:,.0f}".format(dataname))