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
Post a Comment