I'm trying to load a very wide (145 fields) feature class, and to save memory, I want to only load in 6 of the fields. Following the documentation for the from_featureclass() method, I tried specifying the fields I wanted using the fields parameter.
However, when I specify the fields parameter, I get the error *** TypeError: Expected String or Unicode.
Then, if I remove the fields parameter, the error goes away and the feature class loads successfully.
Has anyone else had this issue? Example code is below. *Notably*, I have tried both with a shapefile and with a feature class in a FGDB, and get the same error with both file types
# fields I want to include in SEDF
fields2use = ['A', 'B', 'CAPCLASS', 'LANES', 'SHAPE', 'SPEED']
# *Successful* loading when NOT specifying the fields parameter
sedf_hwy = pd.DataFrame.spatial.from_featureclass(self.fc_daynet, where_clause=where_sql, sr=self.crs_sacog)
# *Failed* loading when trying to load while specifying fields parameter.
sedf_hwy = pd.DataFrame.spatial.from_featureclass(self.fc_daynet, fields=fields2use, where_clause=where_sql, sr=self.crs_sacog)
# result: *** TypeError: Expected String or Unicode