I have a dataset with an 'id' column that needs to be converted to String. I have tried all the available options to convert it to String, but it still comes out Object. (I can't provide a sample DataFrame, as my dataset is quite big and the problem goes away in the sample DataFrame.)
I have tried all the following commands:
df['id'] = df['id'].astype(str)
df['id'] = df['id'].values.astype(str)
df['id'] = df['id'].apply(str)
df['id'] = df['id'].map(str)
df['id'] = df['id'].apply(lambda x: str(x))
pd.Series(df['id'], dtype = "string")
I would appreciate any helpful leads.