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/.

Documentation

Please check https://data-apis.org/dataframe-api/draft/API_specification/index.html for the methods supported by the Consortium Dataframe Standard.

How to try this out

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

import polars as pl

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

The object df_std is a Standard-compliant DataFrame. Check the API Specification for the full list of methods supported on it.

Compliance with the Standard

This is mostly compliant. Notable differences:

  • for pandas numpy dtypes, the null values (NaN) don't follow Kleene logic;

  • for polars lazy, columns can only be used within the context of the same dataframe. For example:

    Not allowed:

    mask = df2.get_column_by_name('a') > 0
    df1.filter(mask)
    

    Allowed:

    mask = df1.get_column_by_name('a') > 0
    df1.filter(mask)
    
  • for polars lazy, comparisons between different dataframes are not implemented.

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

Uploaded Source

Built Distribution

dataframe_api_compat-0.1.14-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dataframe_api_compat-0.1.14.tar.gz
Algorithm Hash digest
SHA256 42e08908e715e9f7f08bda6d62d86a48fe183953c48effcb134606ce1cc217fd
MD5 d875d522c01ab068c54c96ddea5def96
BLAKE2b-256 00bb321cfe57b6304d5f609da921deb43731a86ca6146733801e81925dc0e40d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dataframe_api_compat-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 1fed9a647c8a107a348b81f354dc42c7126ff0a3e37059220686474825db0373
MD5 e37f06af8fc202d84e80ed3f6409922c
BLAKE2b-256 5ffbafde5cf62755687fbd04b64db5afa14e3fb5d3fa5768713218be0a16678e

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