Is it possible to do method chaining in pandas when
- no variable refering to the dataframe has been assigned, yet
- AND the method needs to refer to the dataframe?
Example: here data frame can be referred to by variable name.
df = pd.DataFrame({"a":[1,2,3], "b":list("abc")})
df = (df
.drop(df.tail(1).index)
#.other_methods
#...
)
df
Is it possible to do this without having assigned the dataframe to a variable name?
df = (pd.DataFrame({"a":[1,2,3], "b":list("abc")})
.drop(??.tail(1).index)
#.other_methods
#...
)
df
Thanks!