Open BartSchuurmans opened 1 week ago
To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.
Your vote helps us identify which enhancements matter most to our users.
Hey
Alternative: Use https://github.com/narwhals-dev/narwhals for a dataframe-agnostic implementation.
I just wanted to note that Streamlit depends on Altair, which in turn already depends on Narwhals. So, Streamlit would be able to use Narwhals functionality with zero cost to its users as they all already have it installed because of Altair
Checklist
Summary
When passing a Polars dataframe to a function that is decorated with
@st.cache_data
, you get the following error:Follow-up of https://github.com/streamlit/streamlit/issues/5088#issuecomment-2338389918
Why?
I want to be able to cache functions that have a Polars dataframe as input.
How?
There is already support for Pandas dataframes:
https://github.com/streamlit/streamlit/blob/9914751b0d59f55cb03c3e871e90f65264895431/lib/streamlit/runtime/caching/hashing.py#L434-L453
Support for Polars dataframes could be implemented the same way. Alternative: Use https://github.com/narwhals-dev/narwhals for a dataframe-agnostic implementation.
Additional Context
No response