... pandas pipe: new


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

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(remove_outliers, min_row_country=20)

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.