Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wibowotangara/898cbcb324542883318cab8e478a5379 to your computer and use it in GitHub Desktop.
Save wibowotangara/898cbcb324542883318cab8e478a5379 to your computer and use it in GitHub Desktop.
for col in df.select_dtypes(include='object').columns.tolist():
value_counts_percentage = df[col].value_counts(normalize=True) * 100
if any(value_counts_percentage > 80):
df = df.drop(columns=col)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment