on-internet
← Community

Functional pipes in python like %>% from R's magrittr

Stack Overflow ·

In R (thanks to magrittr) you can now perform operations with a more functional piping syntax via %>%. This means that instead of coding this: > as.Date("2014-01-01") > as.character((sqrt(12)^2) You could also do this: > "2014-01-01" %>% as.Date > 12 %>% sqrt %>% .^2 %>% as.character To me this is more readable and this extends to use cases beyond the dataframe. Does the python language have support for something similar?

Comments

Sign in or sign up to comment and upvote.

No comments yet.