Created
May 19, 2021 11:21
-
-
Save selva86/50d9d01cbfd3d125ff81df147cac86aa to your computer and use it in GitHub Desktop.
This file contains 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 pandas as pd | |
import numpy as np | |
df = pd.read_csv('Datasets\Titanic.csv').sample(50, random_state=100) | |
n_missing = np.random.randint(4, 15, 1) | |
for i in range(n_missing): | |
row = np.random.randint(1, df.shape[0]) | |
df.at[row, "Age"] = pd.NA | |
for i in range(n_missing): | |
row = np.random.randint(1, df.shape[0]) | |
df.at[row, "Fare"] = pd.NA | |
for i in range(n_missing): | |
row = np.random.randint(1, df.shape[0]) | |
df.at[row, "Sex"] = pd.NA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment