I have a dataframe (df)as follows
Index Month Time Text_1 Text_2 Text_3
0 02/2019 19:44:33 aadd@34:9984 (none)\ 62fa6297-f5f5-4c47-8236-4a85cad5e601
STBROWN2-M-26YQ
1 02/2019 19:30:22 58:EF:68:14 (none)\ f933fb2a-4dde-a547-80ca-3b9e6cd29a6d
STBROWN2-M-26YQ
I have written a simple regex as follows
def clean(text):
text = text.lower()
text_clean = re.sub('[^A-Za-z0-9]', ' ', text)
return text_clean
Then I apply the above on the df
df.apply(lambda x : clean(x))
I am getting the following error:
AttributeError: ("'Series' object has no attribute 'lower'", 'occurred at index Application')
It could be because of Month and Time column as they are datetime object.
My question is: How to apply a regex while ignoring the datetimes?
TypeError: ('expected string or bytes-like object', 'occurred at index Application')