{"id":23510,"library":"dataframe-api-compat","title":"DataFrame API Compat","description":"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.","status":"active","version":"0.2.7","language":"python","source_language":"en","source_url":"https://github.com/data-apis/dataframe-api-compat","tags":["dataframe","standard","compatibility","pandas","polars","api"],"install":[{"cmd":"pip install dataframe-api-compat","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The old private method pattern changed; now use the standalone function.","wrong":"import dataframe_api_compat\npandas_df.__convert_to_standard__()","symbol":"convert_to_standard","correct":"from dataframe_api_compat import convert_to_standard"}],"quickstart":{"code":"import pandas as pd\nfrom dataframe_api_compat import convert_to_standard\n\ndf_pd = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})\ndf_std = convert_to_standard(df_pd)\nprint(type(df_std))  # <class 'dataframe_api_compat.pandas_standard.PandasDataFrame'>\nprint(df_std.a.mean())  # 2.0","lang":"python","description":"Convert a pandas DataFrame to the standard DataFrame API and perform operations."},"warnings":[{"fix":"Update imports to `dataframe_api_compat.pandas_standard` or use the top-level `convert_to_standard` function.","message":"In version 0.2.0 the namespace changed from `dataframe_api_compat.pandas` to `dataframe_api_compat.pandas_standard`. Old imports will break.","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Replace `df.__convert_to_standard__()` with `convert_to_standard(df)`.","message":"The method `__convert_to_standard__` on DataFrame objects is deprecated; use `convert_to_standard(df)` instead.","severity":"deprecated","affected_versions":">=0.2.0, <0.3.0"},{"fix":"Check the supported operations list in the documentation before relying on a method.","message":"The 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from dataframe_api_compat.pandas_standard import PandasDataFrame` or use the top-level `convert_to_standard`.","cause":"The submodule was renamed to `pandas_standard` in version 0.2.0.","error":"ModuleNotFoundError: No module named 'dataframe_api_compat.pandas'"},{"fix":"Replace `df.__convert_to_standard__()` with `from dataframe_api_compat import convert_to_standard; convert_to_standard(df)`.","cause":"The private method was removed; you must use the standalone function `convert_to_standard`.","error":"'DataFrame' object has no attribute '__convert_to_standard__'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}