I have the following dataframe and I'd like to remove all the whitespace characters and make it lowercase:
df = pd.DataFrame({"col1":[1,2,3,4], "col2":["A","B ", "Cc","D"]})
I tried to do that via df[["col2"]].apply(lambda x: x.strip().lower())
but it raises an error:
AttributeError: ("'Series' object has no attribute 'strip'", 'occurred at index col2')