Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to slice rows? Can it fit into the interchange, or is the standard required? #204

Open
MarcoGorelli opened this issue Jul 21, 2023 · 1 comment · May be fixed by #349
Open

How to slice rows? Can it fit into the interchange, or is the standard required? #204

MarcoGorelli opened this issue Jul 21, 2023 · 1 comment · May be fixed by #349

Comments

@MarcoGorelli
Copy link
Contributor

MarcoGorelli commented Jul 21, 2023

Came across this yesterday: microsoft/vscode-jupyter#13951

        elif _VSCODE_builtins.hasattr(df, "to_pandas"):
            df = df.to_pandas().iloc[start:end]

This could be improved if they only needed to convert to pandas the part of the data which they needed, i.e.:

elif hasattr(df, "__dataframe__"):
    df = pd.api.interchange.from_dataframe(df.__dataframe__().slice_rows(start, end))

Or, if the Standard were actually available:

elif hasattr(df, "__dataframe__") and hasattr(df, "__dataframe_standard__"):
    df = pd.api.interchange.from_dataframe(df.__dataframe_standard().slice_rows(start, end).dataframe)

So, could this fit into the interchange protocol, or would filtering by rows only be possible for libraries implementing the standard?

It just seems a bit much to require the standard (especially if a separate compatibility package is required for it) if all people need to do is slice rows

@MarcoGorelli
Copy link
Contributor Author

Similarly for to_array_api_compliant_object

They both seem useful enough, and independent of the Standard, that perhaps they could fit together with the interchange?

@MarcoGorelli MarcoGorelli linked a pull request Feb 13, 2024 that will close this issue
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 a pull request may close this issue.

1 participant