No surprise I use python, but I’ve recently started experimenting with polars instead of pandas. I’ve enjoyed it so far, but Im not sure if the benefits for my team’s work will be enough to outweigh the cost of moving from our existing pandas/numpy code over to polars.

I’ve also started playing with grafana, as a quick dashboarding utility to make some basic visualizations on some live production databases.

2 points

I only dabble, but I really like Julia. Has several language and architecture features I really like compared to python. Also looks like the libraries have been getting really good since last I used it much.

permalink
report
reply
1 point

Anyone have any good pointers to DevOps resources or strategies? My data scientists keep stating that they need different approaches to ci/cd, but never seem to have actual requirements other than wanting to do things differently. I’d really like to offer them an easy way to get what they need while also complying with company policy and industry best practices, but it doesn’t seem to have any real differences

permalink
report
reply
3 points

I like pandas but sometimes figuring out the simplest of shit is so complicated

permalink
report
reply
1 point

I learned SQL before pandas. It’s still tabular data, but the mechanisms to mutate/modify/filter the data are different methodologies. It took a long time to get comfy with pandas. It wasnt until I understood that the way you interact with a database table and a dataframe are very different, that I started to finally get a grasp on pandas.

permalink
report
parent
reply
1 point

Wow, I feel seen. Currently fighting this battle, any tips or resources you found helpful?

I think it’s the index(?), aggregation, and order of operations I’m struggling with the most.

permalink
report
parent
reply
1 point

First off, understanding the different data structure from a high level is mandatory. I would understand the difference between a dataframe, series, and index are. Further, learn how numpy’s ndarrays play a role.

From there, unfortunately, I had to learn by doing…or rather struggling. It was one question at a time to stack overflow, like “how to filter on a column in pandas”. Maybe in the modern era of LLMs, this part might be easier. And eventually, I learned some patterns and internalized the data structures.

permalink
report
parent
reply
4 points

Not a data scientist, but an actuarie. I use python, pandas in jupyter notebooks (vs code). I think it would be cool to use polars, but my datasets are not that big to justify the move.

permalink
report
reply
0 points

If it works, don’t fix it!

permalink
report
parent
reply
1 point

What do you enjoy/find beneficial about polars?

permalink
report
reply
5 points

Its a paradigm shift from pandas. In polars, you define a pipeline, or a set of instructions, to perform on a dataframe, and only execute them all at once at the end of your transformation. In other words, its lazy. Pandas is eager, which every part of the transformation happens sequentially and in isolation. Polars also has an eager API, but you likely want to use the lazy API in a production script.

Because its lazy, Polars performs query optimization, like a database does with a SQL query. At the end of the day, if you’re using polars for data engineering or in a pipeline, it’ll likely work much faster and more memory efficient. Polars also executes operations in parallel, as well.

permalink
report
parent
reply
1 point

What kind of query optimization can it for scanning data that’s already in memory?

permalink
report
parent
reply
6 points

A big feature of polars is only loading applicable data from disk. But during exporatory data analysis (EDA) you often have the whole dataset in memory. In this case, filters wont help much there. Polars has a good page in their docs about all the possible optimizations it is capable of. https://docs.pola.rs/user-guide/lazy/optimizations/

One I see off the top is projection pushdown, which only selects relevant columns for a final transformations. In pandas, if you perform a group by with aggregation, then only look at a few columns, you still perform aggregation across all the data. In polars lazy API, you would define the entire process upfront, and it would know not to aggregate certain columns, for instance.

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 2.3K

    Monthly active users

  • 971

    Posts

  • 8.7K

    Comments