Skip to main content

Package to perform pre processing steps for machine learning models

Project description

Tubular pre-processing for machine learning!


PyPI Read the Docs GitHub GitHub last commit GitHub issues Build Binder

tubular implements pre-processing steps for tabular data commonly used in machine learning pipelines.

The transformers are compatible with scikit-learn Pipelines. Each has a transform method to apply the pre-processing step to data and a fit method to learn the relevant information from the data, if applicable.

The transformers in tubular work with data in pandas DataFrames.

There are a variety of transformers to assist with;

  • capping
  • dates
  • imputation
  • mapping
  • categorical encoding
  • numeric operations

Here is a simple example of applying capping to two columns;

from tubular.capping import CappingTransformer
import pandas as pd
from sklearn.datasets import fetch_california_housing

# load the california housing dataset
cali = fetch_california_housing()
X = pd.DataFrame(cali['data'], columns=cali['feature_names'])

# initialise a capping transformer for 2 columns
capper = CappingTransformer(capping_values = {'AveOccup': [0, 10], 'HouseAge': [0, 50]})

# transform the data
X_capped = capper.transform(X)

Installation

The easiest way to get tubular is directly from pypi with;

pip install tubular

Documentation

The documentation for tubular can be found on readthedocs.

Instructions for building the docs locally can be found in docs/README.

Examples

To help get started there are example notebooks in the examples folder in the repo that show how to use each transformer.

To open the example notebooks in binder click here or click on the launch binder shield above and then click on the directory button in the side bar to the left to navigate to the specific notebook.

Issues

For bugs and feature requests please open an issue.

Build and test

The test framework we are using for this project is pytest. To build the package locally and run the tests follow the steps below.

First clone the repo and move to the root directory;

git clone https://github.com/lvgig/tubular.git
cd tubular

Next install tubular and development dependencies;

pip install . -r requirements-dev.txt

Finally run the test suite with pytest;

pytest

Contribute

tubular is under active development, we're super excited if you're interested in contributing!

See the CONTRIBUTING file for the full details of our working practices.

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

tubular-1.4.0.tar.gz (806.6 kB view details)

Uploaded Source

Built Distribution

tubular-1.4.0-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

Details for the file tubular-1.4.0.tar.gz.

File metadata

  • Download URL: tubular-1.4.0.tar.gz
  • Upload date:
  • Size: 806.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tubular-1.4.0.tar.gz
Algorithm Hash digest
SHA256 a75349ec0907f3a1873eddb9cac3b60eb446ea615843a01db6cab46550d8ad25
MD5 b0468464760fd5fca4ccdcb4a7afda22
BLAKE2b-256 3efb1d4d37b9a1f2f376321d6f969bb231b7dd780e455b9a9a37399e6b783097

See more details on using hashes here.

File details

Details for the file tubular-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: tubular-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 49.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tubular-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5a2a6c017140f0a9699899642257754915b816d60191bbfab7a4865feb403de
MD5 28c349a1a2b4011719238fcf9a09599a
BLAKE2b-256 f6d76eb1b7b5af1afcf63eef358e16a893c9d5579231033df443442a0f58da7b

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