Support a pd.NA to np.nan/None conversion inside the `sedf.spatial.to_featurelayer()` method
Enhancement request:
Inside the .spatial.to_featurelayer() method check for pd.NA datatypes and replace them with np.nan or None to supress the error message.
Steps to recreate the problem:
1. creating a pandas df from a csv file will produce pd.NA values (if there are missing fields in the csv)
--> works without a problem (pd.NA is the default datatype for null values when setting specific types in pd, e.g. string)
2. Converting the pandas df to a spatially enabled df using arcgis python module (pd.DataFrame.spatial.from_xy())
--> works without a problem
3. Converting the SEDF to a hosted feature layer in AGOL produces following error message:
-> fails with error message:
Could not insert the row because of error message: value #2 - unsupported type: NAType. Recheck your data
Steps to solve the Problem:
1. Fill NAs with numpy nas
2. Convert numpy Nans to None
df.fillna(np.nan)
df = df.replace({np.nan: None})
sedf = pd.DataFrame.spatial.from_xy(df=df, x_column='X', y_column='Y', sr=4326)
item = sedf.spatial.to_featurelayer("test_bug_pd_na")
--> See attached Python Notebook for a example and workaround