Issue with Datetime Field After Converting Dataframe to FeatureSet

395
3
01-23-2024 02:34 PM
taylorrobinfemadhsgovRobin
New Contributor II

I have noticed a bug while trying to convert a dataframe to a featureset using spatial.to_featureset(). It seems to be changing all my datetime fields to the same value in each feature. I have tested this with multiple dataframes, both regular pandas and spatially enabled.

I had been running a script that updates a feature service using data from a spatially enabled dataframe by converting it to a featureset and then using edit_features(). The script had been working fine until recently. I am thinking this issue started happening when we upgraded to ArcGIS Pro 3.2.0, but I have not confirmed that yet. Is this a known bug in the new api release? I am trying to roll back the version and test that theory but have been unable to so due to certain IT restrictions. Any help would be appreciated.

3 Replies
taylorrobinfemadhsgovRobin
New Contributor II

I have just tested and can confirm that this issue is not happening in an older version of the API, so it is an issue with version 2.2.0.

0 Kudos
taylorrobinfemadhsgovRobin
New Contributor II
0 Kudos
kmsmikrud
Occasional Contributor III

Hi,

I am using argis package version 2.0.1 and it appears to be an issue in this version. I have been trying to troubleshoot where the change in datetimes occurs in a scripl figuring it was earlier in the script tool but I've narrowed it down to later when I use the spatial.to_featureset()

I also found the link below on github. 

I have to admit its pretty discouraging since I've been working to update code from arcpy to the API only to run into this bug.

 df = s_lyr.query(where = AK_dt_fltr, out_sr = 26931).sdf
 gsa = GeoSeriesAccessor(df['SHAPE'])
 df['LENGTH_NM'] = gsa.get_length('PLANAR', 'NAUTICALMILES')
 s_lyr.edit_features(updates = df.spatial.to_featureset())

 https://github.com/Esri/arcgis-python-api/issues/1301

0 Kudos