My pandas df:
first second third fourth fifth
0 x y 12 2 0
1 a b 1 1 1
2 c d 2 12 0
To check column data types, I use:
df.info()
It is result:
<class 'pandas.core.frame.DataFrame'>
first 380 non-null object
second 380 non-null object
third 380 non-null object
fourth 380 non-null object
fifth 380 non-null int32
I want to convert first and second column into string:
df['first'] = df['first'].astype(str)
df['second'] = df['second'].astype(str)
I want to check that:
df.info()
first 380 non-null object
second 380 non-null object
third 380 non-null object
fourth 380 non-null object
fifth 380 non-null int32
So it does not worked, where did I made a mistake?