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
?
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
?
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)