<jupyter_start><jupyter_text>Python<jupyter_code>%matplotlib inline

from pathlib import Path
import pandas as pd
import numpy as np
from scipy import stats
from sklearn.utils import resample

import seaborn as sns
import matplotlib.pylab as plt<jupyter_output><empty_output><jupyter_text>Bootstrapping  The major Python packages don’t provide implementations of the bootstrap approach. It can be implemented using the scikit-learn method resample<jupyter_code>loan_inc = pd.read_csv('/content/loans_income.csv', squeeze= True)

results = []
for nrepeat in range(1000):
    sample = resample(loan_inc)
    results.append(sample.median())
results = pd.Series(results)

print('Bootstrap Statistics:')
print(f'original: {loan_inc.median()}')
print(f'bias: {results.mean() - loan_inc.median()}')
print(f'std. error: {results.std()}')<jupyter_output>Bootstrap Statistics:
original: 62000.0
bias: -83.02500000000146
std. error: 232.88113921054162
{'fraction_non_alphanumeric': 0.1074468085106383, 'fraction_numerical': 0.045744680851063826, 'mean_word_length': 6.713114754098361, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '573905', 'license': 'MIT', 'n_tokens_mistral': 349, 'n_tokens_neox': 312, 'n_words': 81, 'path': 'Python/Day22/day22ofmathandstats_Python.ipynb', 'repo_name': 'harsh9898/100daysofstatandmath', 'size': '940'}