Skip to main content

Introduction

This repo is intended to contain a packaged toolbox of some neat, frequently-used data science code snippets and functions. The intention is that the classes should be compatible with the sklearn library.

Have a look at https://dfds-ds-toolbox.readthedocs.io for user guide.

Already implemented:

  • Model selector for regression and classification problems
  • Profiling tool for generating stats files of the execution time of a function

To be implemented in the future:

  • Preprocessing

    • Imbalanced datasets
    • Outlier detection & handling
    • Missing value imputation
  • Feature generation

    • Binning
    • Type variables, create multiple features
    • Timestamp, seasonality variables
    • Object: onehot, grouping, etc.
  • Performance analysis (plots, summary, error analysis)

More ideas might arise in the future and should be added to the list.

A guide on how to install the package and some working examples of how to use the classes can be found in later sections.

Getting Started

Install locally

We use poetry as the package manager and build tool. Make sure you have poetry installed locally, then run

poetry install

Run tests to see everything working

poetry run pytest

Install this library in another repo

Make sure your virtual environment is activated, then install the required packages

python -m pip install --upgrade pip

If you want to install the package dfds_ds_toolbox version 0.8.0, you should run

pip install dfds_ds_toolbox==0.8.0

Versions

See changelog at GitHub.

Contribute

We want this library to be useful across many data science projects. If you have some standard utilities that you keep using in your projects, please add them here and make a PR.

Releasing a new version

When you want to release a new version of this library to PyPI, there is a few steps you must follow.

  1. Update the version in pyproject.toml. We follow Semantic Versioning, so think about if there is any breaking changes in your release when you increment the version.
  2. Draft a new release in Github. You can follow this link or click the "Draft a new release button" on the "releases" page.
    1. Here you must add a tag in the form "v", for example "v0.9.2". The title should be the same as the tag.
    2. Add release notes. The easiest is to use the button "Auto-generate release notes". That will pull titles of completed pull requests. Modify as needed.
  3. Click "Publish release". That will start a Github Action that will build the package and upload to PyPI. It will also build the documentation website.

Documentation

Website

The full documentation of this package is available at https://dfds-ds-toolbox.readthedocs.io

To build the documentation locally run:

pip install -r docs/requirements.txt
cd docs/
sphinx-apidoc -o . ../dfds_ds_toolbox/ ../*tests*
make html

Now, you can open the documentation site in docs/_build/index.html.

Style

We are using Googles Python style guide convention for docstrings. This allows us to make an up-to-date documentation website for the package.

In short, every function should have a short one-line description, optionally a longer description afterwards and a list of parameters. For example

def example_function(some_parameter: str, optional_param: int=None) -> bool:
    """This function does something super smart.

    Here I will dive into more detail about the smart things.
    I can use several lines for that.

    Args:
        some_parameter: Name of whatever
        optional_param: Number of widgets or something. Only included when all the starts align.

    Returns:
         An indicator describing if something is true.
    """

There are many other style issues that we can run into, but if you follow the Google style guide, you will probably be fine.

Examples

To show the intended use and outcome of some of the included methods, we have included a gallery of plots in examples/. To make a new example create a new file and name it something like plot_<whatever>.py. Start this file with a docstring, for example

"""
Univariate plots
================

For a list of features separate in bins and analysis the target distribution in both Train and Test
"""

and after this add the python code needed to create the example plot.

Metadata

Release files for dfds_ds_toolbox 0.11.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 dfds_ds_toolbox 0.11.0
File Size Uploaded
dfds_ds_toolbox-0.11.0.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dfds_ds_toolbox 0.11.0
File Interpreter ABI Platform
dfds_ds_toolbox-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / dfds_ds_toolbox-0.11.0.tar.gz

Download URL dfds_ds_toolbox-0.11.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bff0ae6c778547f11e12344491318f3dd1bdb6f32bf865fb22758d20b38dfc78
BLAKE2b-256 checksum
How to use checksums
5bc156fad545b50ae51d540c0e3f910492f9da4dffc959e1b364a4a4347996bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.2 Linux/6.5.0-1021-azure

Release files / dfds_ds_toolbox-0.11.0-py3-none-any.whl

Download URL dfds_ds_toolbox-0.11.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aea758176b14642efd7932a5e0e1c5e344882ef69d5a539abcbce9ab59ba06ac
BLAKE2b-256 checksum
How to use checksums
a34f10357240b0a261816be4e0012d07fc633b1ac4b1b0cd25f5fe76c59a4401
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.2 Linux/6.5.0-1021-azure

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

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