python - How to drop rows from a pandas dataframe where any column contains a symbol I don't want -


i have csv file encoded in ansi i'm formatting python pandas on non ansi machine. resulting dataframe('df1') has garbage in it.

expirydate      food     color 20150713        banana   yellow 20150714        steak    brown ???             ???(g?0) ??? 

i trying remove 'garbage' line using this:

df1[df1.expirydate.str.contains("?")==false] 

but getting error:

sre_constants.error: nothing repeat 

can help? appreciated!

the pattern ? treated regular expression. match literal ? in content, can escape it:

df1[df1.expirydate.str.contains('\?')==false] 

Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

javascript - Using jquery append to add option values into a select element not working -