Created
August 30, 2022 19:39
-
-
Save joshreini1/8d881eed1e5276cf4c421fbaddbed9c7 to your computer and use it in GitHub Desktop.
Drop empty rows and mostly empty columns
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
#drop unlabeled data | |
abnb_pre = abnb_df.dropna(subset='price') | |
# Delete columns containing either 75% or more than 75% NaN Values | |
perc = 75.0 | |
min_count = int(((100-perc)/100)*abnb_pre.shape[0] + 1) | |
abnb_pre = abnb_pre.dropna(axis=1, thresh=min_count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment