Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like R’s implementation in dplyr, which is pivot_longer and pivot_wider. I’d really like to see those in Postgres.


Weren't those functions moved to tidyr? Anyway they should be taken as a model for how to implement a sane interface for data reshaping in other languages. You can say what you want about R/Wickham, but he's not afraid to thinker with his modules until they find the perfect user experience


true. and it used to be spread() and gather() and those were bad


Yes, the newer "pivot_wider" and "pivot_longer" are just much cleaner and nicer than the 25 different half-broken way you can use in pandas. Luckily I don't have to do a lot of data engineering anymore, because R is just not fun for large projects while pandas is very unergonomic


It sounds like in the past you’ve used pandas/python for this. Any opinions on the best option for pivoting with those tools?


I did and honestly both ways I tried (pivot and melt) looked disappointing compared to tidyr. I just don't like the reliance on indices (and the stateful API that comes with it) in many operations, like in pivot




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: