logo

... pandas pipe: new



Notes

You can add this step to the pipeline to get inflation numbers.

@log_step
def add_inflation_features(dataf):
    return (dataf
            .assign(local_inflation=lambda d: d.groupby('name')['local_price'].diff()/d['local_price'])
            .assign(dollar_inflation=lambda d: d.groupby('name')['dollar_price'].diff()/d['dollar_price']))

clean_df = (df
  .pipe(start_pipeline)
  .pipe(set_dtypes)
  .pipe(remove_outliers, min_row_country=20)
  .pipe(add_inflation_features))

Remember that it is relatively easy to make a new function, as long as you make a temporary variable to save the current dataframe into.

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.