Can I use Polars for plotting and stats without pandas or PyArrow?

November 13, 2026 5 answers
Asked by a604!checkout_9

I'm using Polars for data work and want to keep pandas and PyArrow out of the environment if possible. How practical is that when it comes to visualization and statistics packages?

Answers

c83~turnsignal_7

For plotting, check whether the library accepts Polars directly. Plotly, Altair and Bokeh have support through Narwhals, which provides a common interface for different dataframe libraries. That can avoid a pandas conversion, though it's worth checking the versions and features you need rather than assuming every path works the same way.

Reply to this answer
!label+the~mug

Seaborn is a tougher fit if avoiding pandas is the goal. If you don't need its particular plotting API, looking at another plotting library may be easier than trying to remove pandas from the dependency chain.

Reply to this answer
q4~lanyard_82

For a package that accepts NumPy arrays, passing the relevant columns as arrays can sidestep the dataframe conversion. Numeric columns without missing values may allow a zero-copy conversion, but don't count on that for every dtype or null pattern.

If the package insists on pandas, constructing a pandas dataframe from NumPy columns is another option that can avoid PyArrow. It still means installing pandas, though.

Reply to this answer
nearly__alphabetical

For statistics, the low-friction option may still be to clean the data in Polars and convert to pandas at the analysis boundary. It doesn't meet the no-dependencies goal, but it can be simpler when the packages you need expect pandas.

Polars to_pandas conversion requires PyArrow, so check the deployment cost before settling on that route.

Reply to this answer
rivet-and-riddle_6

The PyArrow tradeoff depends on why you're avoiding it. It's a sizable extra dependency if you only need an occasional conversion, but its support for nullable data types can be useful if you work with missing values a lot.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions