Skip to content

Commit

Permalink
Added a function for simple imputation
Browse files Browse the repository at this point in the history
  • Loading branch information
Argonvi authored Feb 27, 2020
1 parent 23dad08 commit f71261d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clustering_with_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
0: KMeans,
1: AgglomerativeClustering
}
#IMPUTATION OF MISSING VALUES (missing values must be np.nan)
pandas.options.mode.use_inf_as_na = True #infinite values are considered missing

def impute_values(data):
imp = SimpleImputer(strategy = most_frequent)
imp.fit(data)
return pd.DataFrame(imp.transform(data))

#Clustering

Expand Down

0 comments on commit f71261d

Please sign in to comment.