I am trying to remove the rows that only have digits or only characters in it. For example, below is the sample pandas dataframe column:
col1:
business
served business
02446681
C96305407PLA
P0116711
In my results, I would need the below values because the first & second rows contain only characters and third row is just digits.
col1:
C96305407PLA
P0116711
Any suggestions would be appreciated !!
Using two str.contains
df[df.business.str.contains('\d+')&df.business.str.contains('[A-Za-z]')]
Out[48]:
business
2 C96305407PLA
3 P0116711
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With