Created
June 1, 2021 07:28
-
-
Save seahrh/ad732c62ca5be82c83d73bbf3ad56d86 to your computer and use it in GitHub Desktop.
Pandas drop rows that have empty string
This file contains hidden or 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
%%time | |
len1 = len(train) | |
train["col"] = train["col"].str.strip() | |
train.drop(train[train["col"].str.len() == 0].index, inplace=True) | |
len2 = len(train) | |
print(f"{len1 - len2} rows deleted") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment