1
def f(df):
    # do sth on pd.df
    return new_df

Any way could let me use df.f() instead of using f(df) to execute f() on df?

Paul H
  • 59,172
  • 18
  • 144
  • 130
Garvey
  • 1,105
  • 2
  • 12
  • 25

1 Answers1

4

Don't go to the place where you subclass the DataFrame. There be dragons.

Instead, write your function as you have and then do:

df = df.pipe(your_fxn)

Paul H
  • 59,172
  • 18
  • 144
  • 130