I am trying to convert a set of numeric identifier values for a column in a dataframe into a string value.
new_housing.replace({'borough': {'1':'Manhattan', '2':'Bronx', '3':'Brooklyn', '4':'Queens', '5':'Staten Island'}})
I have tried using the .replace function but have been getting an error.
TypeError: Cannot compare types 'ndarray(dtype=int64)' and 'str'
I am fairly new to Python coding and it seems like this may be an issue related to the datatype in the column. Any help would be appreciated. Thanks