Skip to main content

MULTI COLUMN DISTRIBUTION SAMPLER

Function to draw a sample from a given dataframe while maintaining the same distribution of the columns of interest. Also includes a function to determine the minimum sample size needed to ensure the distribution of the columns of interest in the given dataframe.

Overview

In order to draw a sample from a pandas dataframe we can use the sample function. But, this doesn't ensure that the sample drawn would be representative of the distributions of the columns of interest in the dataframe. Although we can use the train_test_split with stratify from sklearn.model_selection for stratified sampling, things get complex once we want the sample to follow the exact distribution for multiple columns. This package abstracts away all the logic and provides you with functions that can be used to determine the minimum sample size reqired for a distributive sample and also the sample itself when involving multiple columns. Since this package ensures a perfect representative sample, the resulting sample will probably be a bit larger compared to the sample size desired. This increase in sample size will be depending on the distributions of the columns in the actual dataframe and also the number of columns factored in while sampling.

Features

  • Multi column based representative sampling
  • Handles both continuous and categorical features
  • Uses Gini index to measure impurity of partion
  • Includes basic tree printing functionality for tree visualization

Requirements

Python 3.x [Optional] Any text editor or IDE of your choice for editing the code.

Installation

multi_column_distribution_sampler can be installed using the following command:

pip install multi_column_distribution_sampler

or

pip3 install multi_column_distribution_sampler

Dependencies

multi_column_distribution_sampler depends on the following packages:-

  • numpy
  • pandas

License

MIT License

Release files for multi-column-distribution-sampler 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multi-column-distribution-sampler 0.0.1
File Size Uploaded
multi_column_distribution_sampler-0.0.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for multi-column-distribution-sampler 0.0.1
File Interpreter ABI Platform
multi_column_distribution_sampler-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / multi_column_distribution_sampler-0.0.1.tar.gz

Download URL multi_column_distribution_sampler-0.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
789713d49239424ad78f4d40ae56a86667c14db13c06645720d1794dacb6667c
BLAKE2b-256 checksum
How to use checksums
c30304aeba897a28d9f71ed553884aa819245f67ab393cf7ab8e4789ceef5b0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.6

Release files / multi_column_distribution_sampler-0.0.1-py3-none-any.whl

Download URL multi_column_distribution_sampler-0.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76a8db0333fb3e8e8e8d69a32b03f68ee1a7f1653aaff90b080f677ac48f6e74
BLAKE2b-256 checksum
How to use checksums
ea68b087f0fef34127dec308c9e19a45f933925382d3bf9f50b37afdf66e3589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

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