Skip to main content
Github Actions status Coverage Documentation status Latest PyPI version Python versions supported License Code style: black https://img.shields.io/badge/style-wemake-000000.svg

pandas-select is a collection of DataFrame selectors that facilitates indexing and selecting data, fully compatible with pandas vanilla indexing.

The selector functions can choose variables based on their name, data type, arbitrary conditions, or any combination of these.

pandas-select is inspired by the excellent R library tidyselect.

Installation

pandas-select is a Python-only package hosted on PyPI. It can be installed via pip:

pip install pandas-select

Design goals

# pandas-select
df[AllNumeric()]
# vanilla
df.select_dtypes("number").columns

# pandas-select
df[StartsWith("Type") | "Legendary"]
# vanilla
df.loc[:, df.columns.str.startswith("Type") | (df.columns == "Legendary")]
# pandas-select
df_mi.loc[Contains("Jeff", axis="index", level="Name")]

# vanilla
df_mi.loc[df_mi.index.get_level_values("Name").str.contains("Jeff")]
  • Play well with machine learning applications.

    • Respect the columns order.

    • Allow deferred selection when the DataFrame’s columns are not known in advance, for example in automated machine learning applications.

    • Offer integration with sklearn.

      from pandas_select import AnyOf, AllBool, AllNominal, AllNumeric, ColumnSelector
      from sklearn.compose import make_column_transformer
      from sklearn.preprocessing import OneHotEncoder, StandardScaler
      
      ct = make_column_transformer(
         (StandardScaler(), ColumnSelector(AllNumeric() & ~AnyOf("Generation"))),
         (OneHotEncoder(), ColumnSelector(AllNominal() | AllBool() | "Generation")),
      )
      ct.fit_transform(df)

Project Information

pandas-select is released under the BS3 license, its documentation lives at Read the Docs, the code on GitHub, and the latest release on PyPI. It is tested on Python 3.6+.

Metadata

Release files for pandas-select 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandas-select 0.2.0
File Size Uploaded Provenance Actions
pandas-select-0.2.0.tar.gz 16.2 kB Without provenance Details for pandas-select-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pandas-select 0.2.0
File Interpreter ABI Platform Actions
pandas_select-0.2.0-py3-none-any.whl Python 3 none any Details for pandas_select-0.2.0-py3-none-any.whl

Total release size: 33.3 kB

Release files / pandas-select-0.2.0.tar.gz

Download URL pandas-select-0.2.0.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bb9efaacfb5aab5e34d98ea7f5b58c39490e40ab19f695ae3cafd032eece23b3
BLAKE2b-256 checksum
How to use checksums
30d8aacebbe3b64ba989e2478fe765c6c9e40ab10278a3492cb4f38872b07c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.5 Linux/5.9.11-3-MANJARO

Release files / pandas_select-0.2.0-py3-none-any.whl

Download URL pandas_select-0.2.0-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0df51cba4e523b996e87cc5e3db7980dcf42b88f55cb58dc3191b333c30dd6cd
BLAKE2b-256 checksum
How to use checksums
8b02811b70ca079f286df091e5f828929317d5a4cbd42a00ca4a832537e09d66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.5 Linux/5.9.11-3-MANJARO

Security for pandas-select 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page