Trying to convert kaggle titanic dataset pclass column datatype from int to string. Using pandas 1.0.5.
df.Pclass.head()
0 3
1 1
2 3
3 1
4 3
Name: Pclass, dtype: int64
Code is below:
df['Pclass'] = df['Pclass'].astype('string')
Thrown error as below:
ValueError: StringArray requires a sequence of strings or pandas.NA
Note: This worked for first time,not sure from 2nd time onwards keep getting this error.