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-eager

Note: there is ongoing discussion about lazy engines in the Standard. Until that has been resolved, this package should not be relied upon for polars-lazy.

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.10.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

dataframe_api_compat-0.1.10-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dataframe_api_compat-0.1.10.tar.gz
Algorithm Hash digest
SHA256 525d77461cc65845aada129c339ae13bdf8c791c4e505d5c28a751795accfeca
MD5 f93b4577ad843ec481874e53b2667894
BLAKE2b-256 ecb632fb6a7a230e815fcfd6e44f29216cd4776230f7bc730ebd629d5fec48ed

See more details on using hashes here.

File details

Details for the file dataframe_api_compat-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for dataframe_api_compat-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e395cebfc4f42cf98993e095dea3987c7fef05ecbf930acd8437ae5bbf390790
MD5 b463e019157a92d36a740f258437bd65
BLAKE2b-256 89b80cbd4fe79526d40ba0125988dabc9aec272bac7d908f90ba22100ae91e7b

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