Pandas

Feature importance

Inspecting the importance of features when running Random Forest:

feature_importances = pd.DataFrame(rf.feature_importances_,
                                   index = X_train.columns,
                                    columns=['importance']).sort_values('importance',                                                                 ascending=False)

pandas shuffle

df.shuffle(frac=1) uses the shuffle function for this.

Language

  • for illustration purposes and with no loss of generality, ..

    Order after groupby()

    It’s kinda logical, but if I group stuff, it gets saved in the same order.