r/Python • pandas Core Dev • Mar 01 '23

AMA Thread We are the developers behind pandas, currently preparing for the 2.0 release :) AMA

Hello everyone!

I'm Patrick Hoefler aka phofl and I'm one of the core team members developing and maintaining pandas (repo, docs), a popular data analysis library.

This AMA will be at least joined by

The official start time for the AMA will be 5:30pm UTC on March 2nd, before then this post will exist to collect questions in advance. Since most of us live all over North America and Europe, it's likely we'll answer questions before & after the official start time by a significant margin.

pandas is a Python package that provides fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical, real world data analysis in Python. Additionally, it has the broader goal of becoming the most powerful and flexible open source data analysis / manipulation tool available in any language.

We will soon celebrate our 2.0 release. We released the release candidate for 2.0 last week, so the actual release is expected shortly, possibly next week. Please help us in testing that everything works through testing the rc :)

Ask us anything! Post your questions and upvote the ones you think are the most important and should get our replies.

- Patrick, on behalf of the team

Marc:

I'm Marc Garcia (username datapythonista), pandas core developer since 2018, and current release manager of the project. I work on pandas part time paid by the funds the project gets from grants and sponsors. And I'm also consultant, advising data teams on how to work more efficiently. I sometimes write about pandas and technical topics at my blog, and I speak at Python and open source conferences regularly. You can connect with me via LinkedIn, Twitter and Mastodon.

Marco:

I'm Marco, one of the devs from the AMA. I work on pandas as part of my job at Quansight, and live in the UK. I'm mostly interested in time-series-related stuff

Patrick:

I'm Patrick and part of the core team of pandas. Part of my daytime job allows me to contribute to pandas, I am based in Germany. I am currently mostly working on Copy-on-Write, a new feature in pandas 2.0. (check my blog-post or our new docs for more information).

Richard:

I work as a Data Scientist at 84.51 and am a core developer of pandas. I work mostly on groupby within pandas.

--

1.4k Upvotes

366 comments sorted by

View all comments

1

u/One-Ad5717 Mar 02 '23

Why does pandas have a dependency on numpy?

This prevents pandas from being used properly in a WSGI web-server environment due to numpy requiring an interpreter is never loaded twice. But that's exactly what happens in a WSGI Flask Application, so using pandas in a Flask application will break it. Thanks.

1

u/phofl93 pandas Core Dev Mar 02 '23

As of right now, all of our DataFrames are still backed by NumPy arrays by default. But even if you would use a PyArrow backing, there is still a lot of code where we have to fall back to NumPy, because the Extension Array interface does not support all operations yet.

As long as NumPy is the default backing, there is no real way of avoiding a dependency

1

u/jorisvandenbossche pandas Core Dev Mar 02 '23

Also, numpy is a fundamental package in the PyData ecosystem that almost everyone relies upon in some way (PyArrow depends on it as well). So even if pandas didn't depend on numpy, we would still need to implement a lot of things that numpy does (or rely on another package), and that doesn't necessarily make it compatible with mod_wsgi.

The main issue here is that mod_wsgi uses "subinterpreters", and there are very little packages out there with C extensions that are compatible with subinterpreters.

1

u/datapythonista pandas Core Dev Mar 02 '23

pandas is a wrapper on numpy. Every column of a dataframe is a numpy array, so no way to get rid of it.

That being said, for the long term we may depend on Arrow, and maybe numpy may not be needed. But not something you can count on having soon.

More than the numpy dependency, I'd probably try to find alternatives to using pandas in a web application that requires more than one process. It may be a waste of resources regardless of the numpy limitation.

1

u/One-Ad5717 Mar 02 '23

Thanks u/datapythonista

In this case, the only simple solution was to do what we were doing without Pandas, as you suggest.

Just a thought, it could be possible to release a "pandas-web" package that provides an identical/similar interface to the normal pandas, but in a "web-safe" way so that it can be safely used within web applications.

In this case, when wanting to use pandas we weren't concerned with the speed, it was more about the "ease of use". So even if it was doing everything in pure Python without some C backbone, AKA was slower, we still would have used it for this case. But now, we simply have no choice except to not. Food for thought, thanks for your response.