I've been doing data analysis for decades, and stayed on R for a long time because Pandas was so bad.
People complain about R, but compared to the multitude of import lice and unergonomic APIs in Pandas, R always felt like living in the future.
Polars is a much much more sane API, but expressions are very clunky for doing basic computation. Or at least I can't find anything less clunky than pl.col("x") or pl.literal(2) where in R it's just x or 2.
Still, I'm using Python a ton more now that polars has enough steam for others to be able to understand the code.
R's data.table is still my favorite data frames API, over pandas, polars, and spark dataframes. Plotly has edged out ggplot2, but that took a long time.
IMO R is really slept on because it's limited to certain corners of academia, and that makes it seem scary and outdated to compsci folks. It's really a lovely language for data analysis.
Or at least I can't find anything less clunky than pl.col("x") or pl.literal(2) where in R it's just x or 2.
In many cases you can pass a string or numeric literal to a Polars function instead of the pl.col (e.g. select()/group_by()).
Overall I agree it's less convenient than in dplyr in the cases where pl.col is required, sure, but not terrible and has the benefit of making the code less ambigious which reduces bugs.
I think compsci people can appreciate R as a language itself, because it has really beautiful language features. I think programmers hate it, because it's so different and lispy, with features that they can't really appreciate when coming from a C-style OOP mindset.
Even then, the overhead of having an additional five characters per named variable is really unergonomic. I don't know of a way to get around it given Python's limited grammar and semantics without moving to something as Lispy as R.
Comments
I've been doing data analysis for decades, and stayed on R for a long time because Pandas was so bad.
People complain about R, but compared to the multitude of import lice and unergonomic APIs in Pandas, R always felt like living in the future.
Polars is a much much more sane API, but expressions are very clunky for doing basic computation. Or at least I can't find anything less clunky than pl.col("x") or pl.literal(2) where in R it's just x or 2.
Still, I'm using Python a ton more now that polars has enough steam for others to be able to understand the code.
R's data.table is still my favorite data frames API, over pandas, polars, and spark dataframes. Plotly has edged out ggplot2, but that took a long time.
IMO R is really slept on because it's limited to certain corners of academia, and that makes it seem scary and outdated to compsci folks. It's really a lovely language for data analysis.
In many cases you can pass a string or numeric literal to a Polars function instead of the pl.col (e.g. select()/group_by()).
Overall I agree it's less convenient than in dplyr in the cases where pl.col is required, sure, but not terrible and has the benefit of making the code less ambigious which reduces bugs.
I think compsci people can appreciate R as a language itself, because it has really beautiful language features. I think programmers hate it, because it's so different and lispy, with features that they can't really appreciate when coming from a C-style OOP mindset.
I think if that's too painful, you can introduce a convention of: ``` from polars import col as c, lit as l ```
For anything production though, I just stick to pl.col and pl.lit as it's widely used.
Coming from R, that introduces a different confusion problem as there, c() has a specific and common purpose. https://www.rdocumentation.org/packages/base/versions/3.6.2/...
Even then, the overhead of having an additional five characters per named variable is really unergonomic. I don't know of a way to get around it given Python's limited grammar and semantics without moving to something as Lispy as R.
Two characters, if you do `from polars import col as c` you can simply write `c.foo`, assuming the column name is a valid Python identifier.
Oh that's very interesting, thanks!!