Registry / data / dataframe-api-compat

dataframe-api-compat

JSON →
library0.2.7pypypiunverified

A compatibility layer that enables the DataFrame Standard (PEP 764) for pandas and Polars. Version 0.2.7 supports pandas 1.5+ and Polars 0.18+, providing a unified API for common operations. Released monthly.

pip install dataframe-api-compat
INSTALL
IMPORT
SIG · DATAFRAME-API-COMP
D
dataframe-api-compat
datapythonv0.2.7
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

convert_to_standard
from dataframe_api_compat import convert_to_standard
from dataframe_api_compat import convert_to_standard

Convert a pandas DataFrame to the standard DataFrame API and perform operations.

import pandas as pd from dataframe_api_compat import convert_to_standard df_pd = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) df_std = convert_to_standard(df_pd) print(type(df_std)) # <class 'dataframe_api_compat.pandas_standard.PandasDataFrame'> print(df_std.a.mean()) # 2.0
Debug
Known issues
breakingIn version 0.2.0 the namespace changed from `dataframe_api_compat.pandas` to `dataframe_api_compat.pandas_standard`. Old imports will break.
fix
Update imports to `dataframe_api_compat.pandas_standard` or use the top-level `convert_to_standard` function.
affects: <0.2.0
deprecatedThe method `__convert_to_standard__` on DataFrame objects is deprecated; use `convert_to_standard(df)` instead.
fix
Replace `df.__convert_to_standard__()` with `convert_to_standard(df)`.
affects: >=0.2.0, <0.3.0
gotchaThe standard API does not support all pandas/Polars operations. Only column-wise operations (e.g., mean, sum, isna) are guaranteed. Index-based or row-wise operations may fail.
fix
Check the supported operations list in the documentation before relying on a method.
affects: all
Upgrade
Version history
0.2.7latest on PyPI · released Apr 26, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
dataframe-api-compat — pip install dataframe-api-compat · libregistry