Skip to content

Instantly share code, notes, and snippets.

@selva86
Created September 21, 2021 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selva86/8a510227d43a552d07fe96fd29a14859 to your computer and use it in GitHub Desktop.
Save selva86/8a510227d43a552d07fe96fd29a14859 to your computer and use it in GitHub Desktop.
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"] = np.nan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment