Skip to content

Conversation

@ClaytonGillespie
Copy link

Adds support for Polars DataFrames to easychart (and pyarrow etc) using narwhals.

Non-breaking enhancement with minimal changes to existing codebase.

Narwhals is not used to replace pandas, but to allow Polars support as an extra feature, while paving the way for possible future narwhals development. Pandas remains a required dependency and is still used for Timestamps. Heatmaps are run by first converting to pandas.

Pandas index behavior is unchanged. In polars, either the first column is used, row numbers for a series, or an index can be passed in explicitly as per current feature set.

LazyFrames are not supported - this does not seem necessary with minimal data wrangling in easychart.

All 102 tests pass. Narwhals test script is added for extra testing with polars and pyarrows as optional imports, alongside an update to the README. (Happy to discuss more docs).

narwhals.stable.v2 is used for guaranteed backwards compatibility.

Changes:

  • setup.py: Added narwhals>=2.0.0 dependency
  • series.py: Detect and convert non-pandas Series/DataFrames
  • encoders.py: JSON serialization for Polars types
  • init.py: Heatmap support for non-pandas DataFrames
  • tests: 12 new tests (Polars, PyArrow, pandas regression)
  • README.md: Added "Plotting with DataFrames" section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant