Skip to main content

Python modules for miscellaneous data analytics applications

Project description

Tests Coverage Test Status 313 Test Status 312 Test Status 311 Test Status 310

Documentation Status

TestPyPI Build Status

PyPI Build Status PyPI Version PyPI Downloads

DOI

Buy Me A Coffee

Cool, but not frozen, packages to augment your Python data analytics experience.

pybear is a scikit-learn-style Python computing library that augments data analytics functionality found in popular packages like scikit-learn and xgboost.

See documentation for more information.

Website: https://pybear.readthedocs.io/en/stable/index.html

License

BSD 3-Clause License. See License File.


Installation

Dependencies

pybear requires:

  • Python (>=3.10)

  • joblib (>=1.3.0)

  • numpy (>=2.1.0)

  • pandas (>=2.2.3)

  • polars (>=1.19.0)

  • psutil (>=5.7.0)

  • scikit-learn (>=1.5.2)

  • scipy (>=1.15.0)

  • typing_extensions (>=4.12.0)

User installation

Install pybear from the online PyPI package repository using pip:

(your-env) $ pip install pybear

Conda distributions are expected to be made available sometime after release to PyPI.


Usage

The folder structure of pybear is nearly identical to scikit-learn. This is so those that are familiar with the scikit layout and have experience with writing the associated import statements have an easy transition to pybear. The pybear subfolders are base, feature_extraction, model_selection, new_numpy, preprocessing, and utilities. For the full layout, see the API section of the pybear website on Read The Docs.

You can import pybear’s packages in the same way you would with scikit. Here are a few examples of how you could import and use pybear modules:

from pybear.preprocessing import InterceptManager as IM

trfm = IM()
trfm.fit(X, y)

from pybear import preprocessing as pp

trfm = pp.ColumnDeduplicator()
trfm.fit(X, y)

Major Modules

AutoGridSearchCV

Perform multiple uninterrupted passes of grid search with sci-kit learn GridSearchCV utilizing progressively narrower search grids.

  • Access via pybear.model_selection.AutoGridSearchCV.

autogridsearch_wrapper

Create your own auto-gridsearch class. A function that wraps any scikit-learn, pybear, or dask_ml GridSearchCV module to create an identical GridSearch class that performs multiple passes of grid search using progressively narrower search grids.

  • Access via pybear.model_selection.autogridsearch_wrapper.

GSTCV (GridSearchThresholdCV)

Perform conventional grid search on a classifier with concurrent threshold search. Finds the global optima for the passed parameters and thresholds. Fully compliant with the scikit-learn GridSearchCV API.

  • Access via pybear.model_selection.GSTCV.

AutoGSTCV

Perform multiple uninterrupted passes of grid search with pybear GSTCV utilizing progressively narrower search grids.

  • Access via pybear.model_selection.AutoGSTCV.

MinCountTransformer

Perform minimum frequency thresholding on numerical or categorical data simultaneously across an entire array of data. Violates the scikit-learn API in that datasets are modified along the example axis (examples may be deleted.) Otherwise is fully compliant with the sci-kit learn transformer API, with fit, transform, and partial_fit methods.

  • Access via pybear.preprocessing.MinCountTransformer.

ColumnDeduplicator

Identify and selectively remove duplicate columns in numerical or categorical data. Fully compliant with the scikit-learn transformer API, with fit, transform, and partial_fit methods. Perfect for removing duplicate columns from one-hot encoded data in a scikit-learn pipeline. Also fits and transforms data batch-wise, such as with dask_ml Incremental and ParallelPostFit wrappers.

  • Access via pybear.preprocessing.ColumnDeduplicator.

InterceptManager

A scikit-style transformer that identifies and manages constant columns in a dataset. IM can remove all, selectively keep one, or append a column of constants. Handles numerical & non-numerical data, and nan-like values. Does batch-wise fitting via a partial_fit method, and can be wrapped with dask_ml Incremental and ParallelPostFit wrappers.

  • Access via pybear.preprocessing.InterceptManager.

SlimPolyFeatures

Perform a polynomial feature expansion on a dataset omitting constant and duplicate columns. Follows the standard scikit-learn transformer API. Handles scipy sparse matrices/arrays. Suitable for sklearn pipelines. Has a partial_fit method for batch-wise training and can be wrapped with dask_ml Incremental and ParallelPostFit wrappers.

  • Access via pybear.preprocessing.SlimPolyFeatures.

The pybear Text Wrangling Suite

pybear has a wide selection of text wrangling tools for those who don’t have a PhD in NLP. Most modules have the dual capability of working with regular expressions or literal strings (for those who don’t know regular expressions!) Most of the modules also accept data in 1D list-like format or (ragged!) 2D array-like format. All of these are built in scikit transformer API style and can be stacked in a scikit pipeline.

These modules can be found in pybear.feature_extraction.text. The modules include:

  • Lexicon - A class exposing 68,000+ English words and a stop words attribute

  • NGramMerger - Join select adjacent tokens together to handle as a single token

  • StopRemover - Remove pybear stop words from a body of text

  • TextJoiner - Join tokenized text into a contiguous string with separators

  • TextJustifier - Justify to a fixed margin; wrap on literals or regex patterns

  • TextLookup - Compare words in a body of text against the pybear Lexicon

  • TextLookupRealTime - Same as TextLookup but with in-situ save capability

  • TextNormalizer - Normalize text to the same case

  • TextPadder - Pad ragged text into shaped containers using fill

  • TextRemover - Remove units of contiguous text

  • TextReplacer - Remove substrings from contiguous text

  • TextSplitter - Split contiguous text into tokens using literal strings or regex

  • TextStatistics - Compile statistics about a body of text

  • TextStripper - Remove leading and trailing spaces from text



Changelog

See the changelog for a history of notable changes to pybear.


Development

Source code

You can clone the latest source code with the command:

git clone https://github.com/PylarBear/pybear.git

Contributing

pybear is not ready for contributions at this time!

Testing

pybear 0.2 is tested via GitHub Actions to run on Linux, Windows, and MacOS, with Python versions 3.10, 3.11, 3.12, and 3.13. pybear is not tested on earlier versions, but some features may work.

If you want to test pybear yourself, you will need:

  • pytest (>=7.0.0)

The tests are not available in the PyPI pip installation. You can get the tests by downloading the tarball from the pybear project page on pypi.org or cloning the pybear repo from GitHub. Once you have the source files in a local project folder, create a poetry environment for the project and install the test dependencies. After installation, open the poetry environment shell and you can launch the test suite from the root of your pybear project folder with:

(your-pybear-env) you@your_computer:/path/to/pybear/project$ pytest tests/

Project History

The project originated in the early 2020’s as a collection of miscellaneous private modules to enhance the python data analytics ecosystem. In 2025, the modules were formalized and bundled together for their first release as pybear.

Help and Support

Documentation

Communication

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

pybear-0.2.3.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybear-0.2.3-py3-none-any.whl (919.6 kB view details)

Uploaded Python 3

File details

Details for the file pybear-0.2.3.tar.gz.

File metadata

  • Download URL: pybear-0.2.3.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pybear-0.2.3.tar.gz
Algorithm Hash digest
SHA256 44bfa1a5b102e8469d0c7c318fa73365af71c310339401e6df76726f8c3a9fa4
MD5 ac5784a059f7f49525be76c05ebd17df
BLAKE2b-256 ab753e70b5aecacb640d834886ddd2502e663a8ae53d0f2bbbcdc43575e2cb17

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybear-0.2.3.tar.gz:

Publisher: pypi-publish.yml on PylarBear/pybear

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pybear-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pybear-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 919.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pybear-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8d91e548ce0ce97372017707edc2f9d87ef40d8d0f4b63a2934084e32ec250e1
MD5 6c16803a7c064d56efca167c6d8d0591
BLAKE2b-256 893f7c2d3944c2f6a8d47292baac4b222836cf6e2c132d97dab73d865766fb09

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybear-0.2.3-py3-none-any.whl:

Publisher: pypi-publish.yml on PylarBear/pybear

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page