How can I remove all the rows if the value of one column list is empty?
so the end result looks like this:
CodePudding user response:
If there are empty lists casting them to boolean, so get True
s for not empty values and filter in boolean indexing
:
df = df[df['ids'].astype(bool)]
But if empty strings ()
compare for not equal:
df = df[df['ids'].ne('()')]
CodePudding user response:
Use:
df = df[df['ids'].map(len)>1]
CodePudding user response:
You can use list comprehension:
df["id"] = [x for x in df["id"] if len(x) >= 1]