Using ArcGIS Python API and Spatially Enabled DataFrames
import arcpy import pandas as pd from arcgis.gis import GIS fc = "City.gdb\\fire_stations" sdf3 = pd.DataFrame.spatial.from_featureclass(fc, fields=["ADDRESS","MUN_NAME"]) sdf3.head()
I am still getting the SHAPE even though I am passing `fields=["ADDRESS","MUN_NAME"]` in the argument to get only ["ADDRESS","MUN_NAME"] in the df
Can you please let me know how I can get rid of the SHAPE column?
Adding to this thread, it's worth noting that if you explicitly include the SHAPE field in the list of fields you specify, it cause a TypeError. So if you're specifying a subset of fields, make sure you do not include SHAPE in that subset:
emp_fields = ['SHAPE', 'SECTOR', 'COUNT'] df_i = pd.DataFrame.spatial.from_featureclass(Path(gdb_empinv).joinpath(fc), where_clause=wherecl_emp, sr=sref_sacog, fields=emp_fields) # Returns TypeError: Expected String or Unicode