I'm working with spatially enabled dataframes (sdf) to develop a workflow using ArcGIS API for Python. In the sdf, I have a field name, facility_id, which has a field type, Float64. I've changed the field type to Int64. When I print a list of field types, facility_id has the old field type, Float64. See attached image to view outputs. Any help is greatly appreciated!
# Change field type
sdf.astype({'facility_id': 'Int64'}).dtypes
# list field types by field name
sdf.dtypes
Solved! Go to Solution.
The problem here is that operation doesn't happen in-place. So, you have to do this to bake into the dataframe:
sdf = sdf.astype({'facility_id': 'Int64'})
You may also use this syntax if you find it less confusing:
sdf["facility_id"] = sdf["facility_id"].astype("Int64")
The problem here is that operation doesn't happen in-place. So, you have to do this to bake into the dataframe:
sdf = sdf.astype({'facility_id': 'Int64'})
You may also use this syntax if you find it less confusing:
sdf["facility_id"] = sdf["facility_id"].astype("Int64")
The second piece of code works perfectly! Thank you for time. It's greatly appreciated!