Pandas: Remove Row Based on Applying Function

Viewed 9167

I have a Pandas DataFrame, df, and it has a column called _text. I want to remove all rows where applying sentence_count to the value in _text column is not 0.

How would I go about this?

Normally with Pandas, I do something like:

result_df = result_df[result_df['_text'] != '']

But now I'm not just using the value in result_df['_text], I'm filtering based on the value calculated by a function...

Thoughts?

Thanks!

1 Answers
Related