Live data from Hacker News

Siuba – A Dplyr Port to Python

github.com

31–32 of 32 posts

Re: Siuba – A Dplyr Port to Python

#31
post #19
post #8

This looks neat, the _ trick is similar to the Self [0] of fastcore (from fastai). However many things are possible with vanilla pandas. I use it a lot for data munging, usually with the fluent interface (method chaining) style [1], e.g.: df.loc[lambda f: ...].groupby(...).agg(["mean", "count"]) It also plays nicely with the black autoformatter. Anonymous functions are verbose and limited in Python, but you can still…

Hey, thanks for pointing out Self--I definitely need to dig into fastcore more! One motivation for developing siuba is that the grouped agg you show requires users specify only one operation on one column. E.g. 1. Calculate mean of x However, common operations like demeaning a column are multiple operations: 1. Calculate mean of x 2. Subtract result of (1) from x In siuba you can just write mutate(res = _.x -_.x.mean…

Fastcore is great. I've been going ape with it recently for a work project, and I've particularly fallen in love with patch. Made it extremely easy to assemble a collection of pure functions into pseudo methods attached to an existing class.

Re: Siuba – A Dplyr Port to Python

#32
post #16

Hey y'all, creator of siuba here--happy to answer any questions! One piece of context I try to bring into discussions is that the way I test and develop siuba is by livecoding data analyses for an hour [1]. I encounter a lot of arguments like "X is possible with pandas", but when I sit down with analysts in realistic settings (e.g. time constrained) it turns out X works in more limited ways then they thought [2][3].…

Is the pipe operator >> specific to pandas objects or is it generally applicable? I'd like to see how you implemented it!
Post reply on HN