Live data from Hacker News

Python Polars Cheatsheet (based on our O'Reilly book)

opensource.posit.co

11–20 of 44 posts

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#11
post #4

We spent the last few weeks compressing our book, Python Polars: The Definitive Guide (nearly 500 pages), down to a two-page cheatsheet. It's a highly lossy compression, but hopefully a useful one! Besides the PDF, there's also an accessible HTML version. We're curious to hear what you think. Let us know if we missed any of your favorite Polars operations, or if you have any feedback on how we organized it.

Is there an .MD version? For, uh, reasons :)

Yes, opensource.posit.co is entirely open source :)

https://github.com/posit-dev/open-source-website/blob/main/c...

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#12
post #3

I get that the data science world has moved on to python, but I always felt that R's data.table had the slickest dataframe developer experience. I have toyed with Polars for a few hours, maybe I should give it a better chance.

That doesn’t justify lots of stuff that R lacks vs Python. Anytime someone new joins my corp, they reluctantly move off of R from their academic days on Python and once in the ecosystem, they never look back

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#13
post #3

I get that the data science world has moved on to python, but I always felt that R's data.table had the slickest dataframe developer experience. I have toyed with Polars for a few hours, maybe I should give it a better chance.

I first learned about R at a python user group meeting. It was when Pandas was new, and we were having a bunch of talks about it. Wes McKinney even came to give one before going to Pycon.

Anyway, the general consensus at the time was that R was much nicer once you had your data, and if all you had to do was transform it. But that everything else was better in Python.

One of our group members did an experimental project, where you could open R inside of python and share memory. So you could theoretically do your API calls and screen scraping and whatnot in Python, then transform your data in R, then take the output and use it to do something else in Python. It was pretty cool, but I think it was just a POC and never really went anywhere.

I tried learning R after that, but didn't get very far with it.

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#14
Despite writing most of my procedural code in Python, I've always preferred doing my data analysis in R. For all of R's warts, the ergonomics of the dplyr + ggplot + the rest of the tidyverse are very tough to beat. My few attempts to use Pandas and matplotlib/seaborne have always proved frustrating. Based on this cheatsheet though, it seems like Polars addresses some of the friction of Pandas. Looking forward to trying it!

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#17
post #14

Despite writing most of my procedural code in Python, I've always preferred doing my data analysis in R. For all of R's warts, the ergonomics of the dplyr + ggplot + the rest of the tidyverse are very tough to beat. My few attempts to use Pandas and matplotlib/seaborne have always proved frustrating. Based on this cheatsheet though, it seems like Polars addresses some of the friction of Pandas. Looking forward to try…

Less friction, considerably faster. I have a statistician friend who's recently made the jump away from R. I think he would agree with you.

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#18
post #15

I've moved from python/polars/pandas to DuckDB and have not looked back

even for just in-memory quick data analysis?

spinning up a venv with duckdb: 5 minutes

using sql everywhere; never having to remember dataframe syntax: timeless

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#19
post #15

I've moved from python/polars/pandas to DuckDB and have not looked back

Same. Almost every time I would use its streaming interfaces in Python, it would STILL materialize everything into memory. That was like 6 months ago. Maybe streaming interfaces actually work, but I found them to be leaky abstractions that required a ton of hand holding to make sure they didn't build a bunch of memory pressure, if you're lucky enough to even have a way to do it.

For example, last time I used it, you couldn't do NDJSON streaming scans from S3 (looks like fixed with PR #26563).

Re: Python Polars Cheatsheet (based on our O'Reilly book)

#20
post #6
post #3

I get that the data science world has moved on to python, but I always felt that R's data.table had the slickest dataframe developer experience. I have toyed with Polars for a few hours, maybe I should give it a better chance.

The bare R experience is not that great, to put it mildly, but it's a whole other story if you add tidyverse on top of it. The data work becomes really easy then, but I still prefer Python because of familiarity and a better experience & ecosystem when you want to do anything beyond data wrangling & analysis. I found `polars` to be a better experience than `pandas` even though I'd say it leaks some "Rustisms" in its…

> The bare R experience is not that great

Why do you say that? Base R is arguably nicer to work with data than pandas is for example. Happy to provide specific examples to prove my point if you want.

Post reply on HN