Skip to content

Conversation

@MariusWirtz
Copy link
Collaborator

No description provided.

@MariusWirtz MariusWirtz changed the title Work in progress BYOD - Allow Polars Nov 8, 2025
@vmitsenko
Copy link
Collaborator

Hey, I’ve been looking into how the interface can be generalised. Seems like Python’s Protocol may be a good fit here—it gives a clean way to define the minimal set of methods/attributes we expect from a “dataframe-like” object, without committing to a specific backend. This should make it easier to support pandas, polars, and others in a consistent way.

I tested this approach with both pandas and polars and it seems to be working. Here’s the example I used:


from DataFrameUtils import build_cellset_from_dataframe, convert_to_dataframe_like

import pandas as pd
import polars as pl

data = {
    "Name": ["Alice", "Bob", "Charlie", "Diana", "Alice",],
    "Age": [28, 34, 25, 30, 28],
    "Department": ["HR", "IT", "Marketing", "Finance", "HR",],
    "Salary": [55000, 72000, 48000, 61000, 45000]
}

df_pl = pl.DataFrame(data)
df_pd = pd.DataFrame(data)

cellset_pd = build_cellset_from_dataframe(convert_to_dataframe_like(df_pd))
cellset_pl = build_cellset_from_dataframe(convert_to_dataframe_like(df_pl))

Also, all unit tests are passed for the write_dataframe

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.

3 participants