Skip to main content

Statistical Bootstrap with Pandas made easy

Project description

Pandas Bootstrap

Ruff Tests PyPI version docs codecov

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.3.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pandas_bootstrap-0.3.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for pandas_bootstrap-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1c11e5c0df8bf2ba2c051fda0e036356a0dd54712b9905ce931b5d4399a36db3
MD5 4a75be52b95ab4e3b61fa06148ecb565
BLAKE2b-256 3ce6a82d8368d09c04967d21b1a36c2298c9d6ce70d1341b05cadb98f1965476

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pandas_bootstrap-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98b25dec1f891869cccf557fe2411e4c29bd961a91eef884d6c5e5a60fc3e1ad
MD5 bfdfdc4966fd40f992039548f7d42503
BLAKE2b-256 2a699b81bea0fd33c28e47ec2d8dd944d66a3f0b0a12cfdfabc4b889a8ca1b8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page