In R (thanks to magritrr) you can now perform operations with a more functional piping syntax via %>%. This means that instead of coding this: <
The pipe functionality can be achieved by composing pandas methods with the dot. Here is an example below.
Load a sample data frame:
import seaborn
iris = seaborn.load_dataset("iris")
type(iris)
#
Illustrate the composition of pandas methods with the dot:
(iris.query("species == 'setosa'")
.sort_values("petal_width")
.head())
You can add new methods to panda data frame if needed (as done here for example):
pandas.DataFrame.new_method = new_method