-
-
Save ashwinprasadme/8a467214e0787be17fbfb1a7da41c01a 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
## finding all columns that have nan: | |
droping_list_all=[] | |
for j in range(0,7): | |
if not df.iloc[:, j].notnull().all(): | |
droping_list_all.append(j) | |
#print(df.iloc[:,j].unique()) | |
droping_list_all |
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
# filling nan with mean in any columns | |
for j in range(0,7): | |
df.iloc[:,j]=df.iloc[:,j].fillna(df.iloc[:,j].mean()) |
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
# another sanity check to make sure that there are not more any nan | |
df.isnull().sum() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment