Skip to content

Instantly share code, notes, and snippets.

@siddharthganjoo
Created August 23, 2021 07:09
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 siddharthganjoo/ac6942f19f59bb01c2a6ae0c91430bbf to your computer and use it in GitHub Desktop.
Save siddharthganjoo/ac6942f19f59bb01c2a6ae0c91430bbf to your computer and use it in GitHub Desktop.
#data preprocessing
a = pd.get_dummies(df['cp'], prefix = "cp")
b = pd.get_dummies(df['thal'], prefix = "thal")
c = pd.get_dummies(df['slope'], prefix = "slope")
frames = [df, a, b, c]
df = pd.concat(frames, axis = 1)
df = df.drop(columns = ['cp', 'thal', 'slope'])
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment