Skip to content

Instantly share code, notes, and snippets.

@ajoydas
Created November 17, 2018 17:25
Show Gist options
  • Save ajoydas/1be0020fc0597d343a841d325f9604a7 to your computer and use it in GitHub Desktop.
Save ajoydas/1be0020fc0597d343a841d325f9604a7 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
df3 = pd.read_csv('datasets/CustomerChurn.csv')
df3 = df3.drop('customerID', axis=1)
df3 = df3.replace(r'^\s+$', np.nan, regex=True)
df3['TotalCharges'] = df3['TotalCharges'].astype(float)
df3 = df3.fillna(df3.mean())
df3.isnull().values.any()
for key in df3.keys():
# print(np.unique(df3[key]))
print(key+' '+str(len(np.unique(df3[key]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment