Skip to content

Instantly share code, notes, and snippets.

@joshreini1
Created August 30, 2022 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshreini1/8d881eed1e5276cf4c421fbaddbed9c7 to your computer and use it in GitHub Desktop.
Save joshreini1/8d881eed1e5276cf4c421fbaddbed9c7 to your computer and use it in GitHub Desktop.
Drop empty rows and mostly empty columns
#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