Remove rows from pandas dataframe that has column containing string where words have greater than a certain length

I have this dataframe

qid question_stemmed    target  question_length total_words 443216  56da6b6875d686b48fde    mathfracint1x53x5 tantanboxedint1x01x2 sumvarp...   1   589 40 163583  1ffca149bd0a19cd714c    mathoverbracesumvartheta8infty vecfracsumkappa...   1   498 31 522266  663c7523d48f5ee66a3e    star trek 2013 ?make warping look quite bit li...   0   449 66 341312  42dc38e62f0bdebfa6b6    answer mathfrac4222262mid 5501int846fracomega2...   0   334 11 149952  1d53c9c017999b4f77e2    8430397824532987451912384179815150754023741609...   0   241 3 

I am looking to remove rows like above where question_stemmed column in this case has a string of multiple words where word length exceeds a certain character length (Ex: 15 characters)

How do i achieve the above? I found another stackoverflow link – Remove the rows from pandas dataframe, that has sentences longer than certain word length

but that essentially removes rows where number of words is greater than a certain limit, but my objective is different. Appreciate any help here!

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.