-
-
Save sazio/dc90bd9c7d1666e12c90c2b79936c60d 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 | |
# Create a dataframe (categorical data) | |
df = pd.DataFrame([["a", "x"], | |
[np.nan, "y"], | |
["a", np.nan], | |
["b", "y"]], dtype="category") | |
imp = SimpleImputer(strategy="most_frequent") | |
print(imp.fit_transform(df)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment