Last active
September 20, 2025 06:10
-
-
Save H2CO3/c1c4557c8556cd0ae34e589bd5aee6fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pandas as pd | |
| install = np.concatenate([np.ones(19), np.zeros(1)]) | |
| repair = np.concatenate([np.ones(19), [np.nan]]) | |
| outage = np.concatenate([np.ones(17), np.zeros(1), [np.nan, np.nan]]) | |
| df = pd.DataFrame({'install': install, 'repair': repair, 'outage': outage}) | |
| print(df) | |
| proportions = [] | |
| for i in range(1_000_000): | |
| indexes = np.random.choice(a=len(df), size=len(df), replace=True) | |
| p = np.nanmean(df.iloc[indexes].to_numpy()) | |
| proportions.append(p) | |
| proportions = np.array(proportions) | |
| mean = np.mean(proportions) | |
| std = np.std(proportions) | |
| print(f'{mean=!s}, {std=!s}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment