Skip to main content

Implementation of the DataFrame Standard for pandas and polars

Project description

Build Status Coverage pre-commit.ci status

DataFrame API Compat

standard-compliant DataFrame

Implementation of the DataFrame Standard for pandas and polars.

What's this?

Please read our blog post! https://data-apis.org/blog/dataframe_standard_rfc/.

How to try this out

Here's an example of how you can try this out:

import pandas as pd
from dataframe_api_compat import pandas_standard
from dataframe_api_compat import polars_standard

def convert_to_standard_compliant_dataframe(df):
    if isinstance(df, pd.DataFrame):
        return pandas_standard.convert_to_standard_compliant_dataframe(df)
    elif isinstance(df, pl.DataFrame):
        return polars_standard.convert_to_standard_compliant_dataframe(df)
    else:
        raise TypeError(f"Got unexpected type: {type(df)}")

df = pd.DataFrame({'a': [1,2,3]})
df_std = convert_to_standard_compliant_dataframe(df)

The object df_std is a Standard-compliant DataFrame.

Installation

pip install dataframe-api-compat

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataframe_api_compat-0.1.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

dataframe_api_compat-0.1.3-py2.py3-none-any.whl (13.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dataframe_api_compat-0.1.3.tar.gz.

File metadata

  • Download URL: dataframe_api_compat-0.1.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for dataframe_api_compat-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ca4f560fae3d4b97311e3b3d1f93c6c6dd4bd18bd989d83826bc1584332cc968
MD5 5bc5b29b16758fd9f391dc11989628f1
BLAKE2b-256 1dc1326e6867a9ca0b04057149c97565b4bdc30d841bf51d81f069a55e83b023

See more details on using hashes here.

File details

Details for the file dataframe_api_compat-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dataframe_api_compat-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5fb083967a370aaf3eb63d923c14bcc04e3e0b068b324a5ec3cae0ccc7fc65b6
MD5 34f895ad19b78ec3f2611924a6f24d59
BLAKE2b-256 c449eab304fdaac921bd21207a7c31d18d3b6b0b6692f35dc78a4b9cd00c2a35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page