Skip to main content

Library/framework for making predictions.

Project description

mydatapreprocessing

Python versions PyPI version Binder Language grade: Python Documentation Status License: MIT codecov

Load data from web link or local file (json, csv, Excel file, parquet, h5...), consolidate it (resample data, clean NaN values, do string embedding) derive new featurs via columns derivation and do preprocessing like standardization or smoothing. If you want to see how functions works, check it's docstrings - working examples with printed results are also in tests - visual.py.

Links

Repo on GitHub

Official readthedocs documentation

Installation

Python >=3.6 (Python 2 is not supported).

Install just with

pip install mydatapreprocessing

There are some libraries that not every user will be using (for some data inputs). If you want to be sure to have all libraries, you can download requirements_advanced.txt and then install advanced requirements with pip install -r requirements_advanced.txt.

Examples

You can use live jupyter demo on binder

import mydatapreprocessing as mdp

Load data

You can use

  • python formats (numpy.ndarray, pd.DataFrame, list, tuple, dict)
  • local files
  • web urls

You can load more data at once in list.

Syntax is always the same.

data = mdp.load_data.load_data(
    "https://www.ncdc.noaa.gov/cag/global/time-series/globe/land_ocean/ytd/12/1880-2016.json",
    request_datatype_suffix=".json",
    data_orientation="index",
    predicted_table="data",
)
# data2 = mdp.load_data.load_data([PATH_TO_FILE.csv, PATH_TO_FILE2.csv])

Consolidation

If you want to use data for some machine learning models, you will probably want to remove Nan values, convert string columns to numeric if possible, do encoding or keep only numeric data and resample.

data_consolidated = mdp.preprocessing.data_consolidation(
    data, predicted_column=0, remove_nans_threshold=0.9, remove_nans_or_replace="interpolate"
)

Feature engineering

Functions in feature_engineering and preprocessing expects that data are in form (n_samples, n_features). n_samples are ususally much bigger and therefore transformed in data_consolidation if necessary.

Extend original data with

data_extended = mdp.feature_engineering.add_derived_columns(data_consolidated, differences=True, rolling_means=32)

Preprocessing

preprocess_data returns preprocessed data, but also last undifferenced value and scaler for inverse transformation, so unpack it with _

data_preprocessed, _, _ = mdp.preprocessing.preprocess_data(
    data_extended,
    remove_outliers=True,
    smoothit=None,
    correlation_threshold=False,
    data_transform=False,
    standardizeit="standardize",
)

Creating inputs

Create models inputs with

seqs, Y, x_input, test_inputs = mdp.create_model_inputs.make_sequences(
    data_extended.values, predicts=7, repeatit=3, n_steps_in=6, n_steps_out=1, constant=1
)

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

mydatapreprocessing-2.0.7.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

mydatapreprocessing-2.0.7-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file mydatapreprocessing-2.0.7.tar.gz.

File metadata

  • Download URL: mydatapreprocessing-2.0.7.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

File hashes

Hashes for mydatapreprocessing-2.0.7.tar.gz
Algorithm Hash digest
SHA256 c94d8d20c0b606886f22d481dd52057a97c17ee9b193859c9b50202626171418
MD5 ca63eb89d09a7b14048b2ec56db111f8
BLAKE2b-256 560912b994a3692eba8d0c57388ee2dc34910dc2dea69f85a134275820f180e3

See more details on using hashes here.

File details

Details for the file mydatapreprocessing-2.0.7-py3-none-any.whl.

File metadata

  • Download URL: mydatapreprocessing-2.0.7-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

File hashes

Hashes for mydatapreprocessing-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 12affe8fda75d1cc297ce75cf68ec5b4a574750cc0841a3a2ce4e87907297db8
MD5 5384f8f0f57f91d23b7c3bc37fabb942
BLAKE2b-256 444f4a2225bc24a25b5df1b765176e0d7d3ab144bf29d3a421b828f93dff87ed

See more details on using hashes here.

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