python - Pandas: Remove Row Based on Applying Function -
i have pandas dataframe, df, , has column called _text. want remove rows applying sentence_count value in _text column not 0.
how go this?
normally pandas, like:
result_df = result_df[result_df['_text'] != ''] but i'm not using value in result_df['_text], i'm filtering based on value calculated function...
thoughts?
thanks!
if function takes sentence sole argument,
result_df[result_df['_text'].apply(sentence_count) != 0]
Comments
Post a Comment