3 ms·
Pandas is just a bad API, to be honest. I know base-R very, very well (which was one of the inspirations, I believe) and I still spend most of my time looking s
by disgruntledphd2 6y ago
Pandas is just a bad API, to be honest. I know base-R very, very well (which was one of the inspirations, I believe) and I still spend most of my time looking stuff up.
It's such a shame that python doesn't have a better DF library.
- shankr 6y agoI also switched from R to Python/pandas. I remember always being frustrated with pandas since it tries to emulate data.frame, but then just does its own thing without being consistent.
- EForEndeavour 6y agoI've used pandas regularly for the past ~5 years and find its API intuitive enough not to complain. I can write and read decently long pandas chained expressions fluently, but I barely know any R. Am I unwittingly a hostage of an inferior API and don't know what I'm missing?
- disgruntledphd2 6y agoYes. Base R is OK, but dplyr is magical. For instance, integer indexing in base R is df[row,col] rather than the iloc pandas stuff. plot, print and summary (and generic function OOP more generally is really underappreciated). Python is a better programming language, but R is a better data analysis environment. And dplyr is an incredibly fluent DSL for doing data analysis (not quite as good for modelling though). Seriously, I read the original vignette for dplyr in late 2013/early 2014 and within two weeks I'd switched most of my new analytical code over to it. So very, very good. Less idea-impedance match than any other environment, in my experience.
- shankr 6y agoI was actually using data.table The syntax can be bit cryptic, but you get used to it.
- deleted 6y ago[deleted]
- shankr 6y agoThis might not seem like a big issue but in the beginning, these were my issues 1. Not so easy way to rename columns during aggregation 2. The group by generates its own grouped by data and hence you almost always need `reset_index` 3. Sometimes group by can convert a dataframe to series 4. Now `.loc` has provided bit consistent indexing/slicing, but earlier you had `.ix` `.iloc` and what not These are something I can remember from top of my head. Of course all of these have solutions, but it makes pandas much more verbose. In R, these are just much more succinct.
- closed 6y agoIn case you're interested in what's missing--I maintain a port of dplyr from R to python called siuba, and gave a talk recently on why pandas might be hard to use: https://www.rstudio.com/resources/rstudioglobal-2021/bringing-the-tidyverse-to-python-with-siuba/ https://www.rstudio.com/resources/rstudioglobal-2021/bringin...
- EForEndeavour 6y agoThis is super cool, thank you! Wait... I had no idea dplyr's database support was this good. https://db.rstudio.com/dplyr/ https://db.rstudio.com/dplyr/