Skip to main content

Feature engineering done with Polars

Project description

Feature Engineering with Polars

PyPI - Python Version GitHub codecov

Feature engineering done with Polars

fe-polars

How to install

pip install feature-engineering-polars

How to use it

import polars as pl
from fe_polars.imputing.base_imputing import Imputer
from fe_polars.encoding.target_encoding import TargetEncoder

dataframe = pl.DataFrame(
        {
            "City": ["A", "A", "B", "B", "B", "C", "C", "C"],
            "Rain": [103, None, 90, 75, None, 200, 155, 127],
            "Temperature": [30.5, 32, 25, 38, 40, 29.6, 21.3, 24.9],
        }
    )

imputer = Imputer(features_to_impute=["Rain"], strategy="mean")
encoder = TargetEncoder(smoothing=2, features_to_encode=["City"])

temp = imputer.fit_transform(x=dataframe)
encoder.fit_transform(x=temp, y=dataframe['Temperature'])


shape: (8, 3)
City    Temperature Rain
f64     f64         f64

30.706  30.5        103.0
30.706  32.0        125.0
32.665  25.0        90.0
32.665  38.0        75.0
32.665  40.0        125.0
27.225  29.6        200.0
27.225  21.3        155.0
27.225  24.9        127.0

Available transformers

  • Encoding:
    • Target encoding
    • One hot encoding
  • Imputing:
    • Base imputing:
      • Mean imputing
      • Median imputing
      • Max imputing
      • Min imputing
      • Fixed value imputing

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

feature_engineering_polars-0.5.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file feature_engineering_polars-0.5.0.tar.gz.

File metadata

  • Download URL: feature_engineering_polars-0.5.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.15 Linux/6.8.0-1014-azure

File hashes

Hashes for feature_engineering_polars-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ee33a4d8e7337c1fb8883ab640ed179d86f19280970fb41d2096670a78139194
MD5 393057d915c7dea3db0d7f84de7a9143
BLAKE2b-256 d9ef2e2a7ec40780d502a65f7ac3c12a9a6808c779ea3e4c9c2fb8ccb557d848

See more details on using hashes here.

File details

Details for the file feature_engineering_polars-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for feature_engineering_polars-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a1ad9d3d765dc1f7ae10f0e7c9bbf623db0a74b0b6d7c3fbf4761504c45be3d
MD5 7e691361f872297946265a5820b5fc9a
BLAKE2b-256 c5cedbdf493622f11131edf5afc84d2936b6f45aa37d521afeb412bd875213e8

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