Skip to main content

Statistical Bootstrap with Pandas made easy

Project description

Pandas Bootstrap

Ruff Tests PyPI version docs

Statistical Bootstrap with Pandas made easy.

Installation

pip install pandas-bootstrap

Usage

The module is very easy to use.

  1. import bootstrap
  2. define statistic function: def some_func(df: pd.DataFrame | pd.Series):
  3. get bootstrapped samples: df.boot.get_samples(bfunc=some_func, B=100)

Below is a simple example of bootstrapping the mean of two columns.

import pandas as pd

import bootstrap

df = pd.DataFrame({
    'a': [1, 2, 3, 4, 5],
    'b': [6, 7, 8, 9, 10],
})

def mean_of_columns(df):
    return df.mean(numeric_only=True)

sample_kwargs = dict(random_state=42)
df_bootstrap = df.boot.get_samples(bfunc=mean_of_columns, B=5, sample_kwargs=sample_kwargs)

which results in:

          a    b
sample          
0       3.0  8.0
1       2.6  7.6
2       4.0  9.0
3       3.2  8.2
4       3.0  8.0

Documentation

Read more in the documentation

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

pandas_bootstrap-0.2.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

pandas_bootstrap-0.2.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pandas_bootstrap-0.2.1.tar.gz.

File metadata

  • Download URL: pandas_bootstrap-0.2.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1018-azure

File hashes

Hashes for pandas_bootstrap-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2c0179ff7ddbc84eee28e251fb6a5bc180e087d3d125b8bcf1b7da2976befcb7
MD5 668385e5dbba1d1efacb8651da8c487a
BLAKE2b-256 9509da8e2eb3856575cfd9f4348fe4c7a82628ed72682fabb71e69d54295287f

See more details on using hashes here.

File details

Details for the file pandas_bootstrap-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pandas_bootstrap-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1018-azure

File hashes

Hashes for pandas_bootstrap-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 efdf11671f196974e0e5f684ce0bedf01e638f9068475cd871995eada8057c7a
MD5 3585680d34513a7446863ef17e6af3f2
BLAKE2b-256 a3be3eea29df13bf8712c0b12f04452d571c1e5d5baaea8272f003560ed234eb

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