Skip to main content

Type annotations for Pandas

Project description

Pandas Stubs

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

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

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.

Pandas Version Compatibility

The aim of the current release is to cover the most common parts of the 1.0.4 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

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

Uploaded Source

Built Distribution

pandas_stubs-1.0.4.2-py3-none-any.whl (153.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pandas-stubs-1.0.4.2.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5

File hashes

Hashes for pandas-stubs-1.0.4.2.tar.gz
Algorithm Hash digest
SHA256 9eb7f8a8f2ca154bf465af5f8c4b59385ad16848668187c9396b2b24f2842ca5
MD5 af9ef9f1ec627e6d37698a2724a1d972
BLAKE2b-256 c75139690c1246578e9552afd482b0a835a27df7f62ffd309ba8c77055b5283b

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: pandas_stubs-1.0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 153.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5

File hashes

Hashes for pandas_stubs-1.0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 54a559cd0fbe55ec3b7676a83fc69c0d365a99ebea37bae43a5a8cd4a19f2d61
MD5 39ca71a85ffd4a15e739d8c13ef1e316
BLAKE2b-256 f71c90026edf5f67249f39c9ee594f6dd24211fc8d00fb02885ecf7d4ccbb8b5

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