Skip to main content

Type annotations for Pandas

Project description

Logo

Pandas Stubs

Collection of pandas stub files initially generated using stubgen, fixed when necessary and then partially completed.

CI PyPi version PyPI Downloads Conda Downloads Python support License
VirtusLab PyPI package PyPI download month PyPI download month PyPI pyversions GitHub license

Motivation

Provide rudimentary coverage of pandas code by static type checking, to alleviate problems mentioned in the following issues 14468, 26766. This approach was taken to achieve accelerated development - compared to refactoring existing Pandas codebase creating stub files is relatively uninhibited.

Due to extensive pandas API, quality of the proposed annotations is, for the most part, not suitable for integration into original codebase, but they can be very useful as a way of achieving some type safety during development.

Installation and usage

The easiest way is using PyPI. This will add .pyi files to pandas package location, which will be removed when uninstalling:

pip install pandas-stubs

Another way to install is using Conda:

conda install -c conda-forge pandas-stubs 

Alternatively, if you want a cleaner PYTHONPATH or wish to modify the annotations, manual options are:

  • cloning the repository along with the files, or
  • including it as a submodule to your project repository,

and then configuring a type checker with the correct paths.

Version Compatibility

The aim of the current release is to cover the most common parts of the 1.1.0 API, however it can provide partial functionality for other version as well. Future versions will cover new Pandas releases.

Versioning

The versions follow a pattern MAJOR.MINOR.PATCH.STUB_VERSION where the first three parts correspond to a specific pandas API version, while STUB_VERSION is used to distinguish between the versions of the stubs themselves.

Type checkers

As of now Mypy is the only type checker the stubs were tested with.

Testing

Test the stub files internal consistency:

mypy --config-file mypy.ini third_party/3/pandas

Test the stub files against actual code examples (this will use the stubs from the third_party/3/pandas dir):

mypy --config-file mypy.ini tests/snippets

Test the installed stub files against actual code examples (this will use pandas .pyi files from your env):

mypy --config-file mypy_env.ini tests/snippets

Disclaimer

pandas library and the pandas logo are owned by AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team. This project is not owned, endorsed, or sponsored by any of AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team.

This project provides additional functionality for pandas library. Pandas is available under it's own license.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pandas-stubs-1.2.0.5.tar.gz (90.4 kB view details)

Uploaded Source

Built Distribution

pandas_stubs-1.2.0.5-py3-none-any.whl (157.6 kB view details)

Uploaded Python 3

File details

Details for the file pandas-stubs-1.2.0.5.tar.gz.

File metadata

  • Download URL: pandas-stubs-1.2.0.5.tar.gz
  • Upload date:
  • Size: 90.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for pandas-stubs-1.2.0.5.tar.gz
Algorithm Hash digest
SHA256 331851580c16321bb6ae17610b9ad4705e3b8cdd653ccc18b1ef85e9abe836f0
MD5 ef5f846db02d45b840115dd918cb3586
BLAKE2b-256 c48bcead211a851ff9b59fc658ad4be8341ccd943a18dfc13026e49ae993d30c

See more details on using hashes here.

Provenance

File details

Details for the file pandas_stubs-1.2.0.5-py3-none-any.whl.

File metadata

  • Download URL: pandas_stubs-1.2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 157.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for pandas_stubs-1.2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d04447388aa4e7f2001854192d7a384d9af4540b9591a6b4b3c41da7e1ccd745
MD5 4304f0f2ff30349eb4dbad977b6c83c5
BLAKE2b-256 b07bd553bc5cd25eb55829e4127c22a50e58790b5a50980bb5bd2231c6ad3cd2

See more details on using hashes here.

Provenance

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