I have a column that should have been "born" as type str
. But given it was not -but rather as object
, how in the world can I get it to be of type str
? i've tried a few approaches, which had been documented as supposed to work especially here How to convert column with dtype as object to string in Pandas Dataframe
Given a dataframe dfm
and a list of feature values feats
# this should work as str's but does not
dfm.insert(colx,'top20pct_features', [str(x) for x in feats])
# let's try another way.. but also does not work
dfm.top20pct_features = dfm.top20pct_features.astype(str)
# another way.. same story..
dfm.top20pct_features = dfm.top20pct_features.str
print(dfm.info()) # reports the column as `object`