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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -