4 ms·
So in pandas it's kinda similar: > df[newvar] = df[oldvar1] / df[oldvar2] And instead of the pipe, we have chaining for which is super straightforward and rea
by makmanalp 9y ago
So in pandas it's kinda similar:
> df[newvar] = df[oldvar1] / df[oldvar2]
And instead of the pipe, we have chaining for which is super straightforward and readable:
> df[newvar] = (df[oldvar1] / df[oldvar2]).abs().rank().astype(str).str[:4]
and for more complex or non-chainable functions we have .pipe:
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.pipe.html https://pandas.pydata.org/pandas-docs/stable/generated/panda...
which looks super similar to dplyr to me!