Spatial DataFrame to_featureclass() strips attribute data

334
2
Jump to solution
12-05-2023 08:58 AM
Labels (1)
A_Schwab
New Contributor III

I have a spatially-enabled dataframe with 16 columns: 

sedf.columns
Index(['issuedDate', 'weatherType', 'warningLikelihood', 'warningLevel',
'warningStatus', 'warningHeadline', 'whatToExpect', 'warningId',
'warningVersion', 'warningFurtherDetails', 'modifiedDate',
'validFromDate', 'affectedAreas', 'warningImpact', 'validToDate',
'SHAPE'],
dtype='object')

sample: 

>>> sedf.iloc[0]
issuedDate                                            2023-12-05T10:15:10Z
weatherType                                                         [RAIN]
warningLikelihood                                                        1
warningLevel                                                        YELLOW
warningStatus                                                       ISSUED
warningHeadline          Heavy rain is likely to bring some travel disr...
whatToExpect             [There is a small chance that homes and busine...
warningId                             9ac0f4c2-09ab-41ce-ba8a-6e6ea770e6d3
warningVersion                                                         1.0
warningFurtherDetails    Rain is expected to arrive during Wednesday ev...
modifiedDate                                          2023-12-05T10:15:10Z
validFromDate                                         2023-12-07T00:00:00Z
affectedAreas            [{'regionName': 'South West England', 'regionC...
warningImpact                                                            3
validToDate                                           2023-12-07T15:00:00Z
SHAPE                    {'rings': [[(-2.4005, 51.0966), (-2.2687, 50.9...
Name: 0, dtype: object

 when I run sedf.to_featureclass("path/to/gdb/featureclass"), the resulting featureclass only has 4 of these columnd: SHAPE, modifiedDate, validFromDate, validToDate. 

Exporting the same data from geopandas to geojson or GPKG works fine. 

I've tried using sanitize_columns=False on the SEDF but it makes no difference. 

Does anyone know what might be causing the loss of this attribute data and how I can keep it when saving to featureclass/GDB?

0 Kudos
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

In the past, I remember to_featureclass failing if you had any Python lists in your dataframe. I'm not sure if this is a problem in your case (only noting it because I see lists in the screen).

View solution in original post

2 Replies
EarlMedina
Esri Regular Contributor

In the past, I remember to_featureclass failing if you had any Python lists in your dataframe. I'm not sure if this is a problem in your case (only noting it because I see lists in the screen).

A_Schwab
New Contributor III

That was it, thank you! 

I converted the lists to strings and now it works as expected. 

0 Kudos