4 ms·
In pandas you can chain commands by wrapping the whole command in (). Personally IMO looks far 'cleaner' than all of the ugly %>% everywhere.
by chaxor 3y ago
In pandas you can chain commands by wrapping the whole command in (). Personally IMO looks far 'cleaner' than all of the ugly %>% everywhere.
- civilized 3y agoThe flip side is that in pandas, chaining is less uniform because it is based on methods. In R you can pipe a data frame into any function from any package or one you just wrote, so you use %>% for any piping that happens. In pandas, you have special pandas methods that don't need the pipe, but to pipe with any other function, you have to write .pipe. The comparison is not really between %>% and ., it's between "you just use %>% for everything" and "you use . for a bloated, somewhat arbitrary collection of special pandas methods, and .pipe for everything else".
- civilized 3y agoThe sad thing about the conventional object-oriented programming paradigm is how it put the really cool syntactic idea of piping/chaining in the straitjacket of classes and objects. The ability to pipe shouldn't be tied to whether a function is a method of a class.
- joeman1000 3y agoWhat do you mean by wrapping the command in ()? I haven't seen this before. Do you have a link to where they mention this in the docs?