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
  • 65,268
  • 20
  • 159
  • 136
Garvey
  • 1,197
  • 3
  • 13
  • 26

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
  • 65,268
  • 20
  • 159
  • 136