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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -