Trying to create a feature layer from a pandas dataframe

113
2
10-30-2020 01:47 PM
Labels (1)
Occasional Contributor

Hi I am trying to follow the documentation to convert a dataframe into a feature collection.

Here is the code I am using: 

groups_stats_fc=gis.content.import_data(df)

import json
groups_stats_fc_dict = dict(groups_stats_fc.properties)
groups_stats_fc_json = json.dumps({"featureCollection": {"layers": [groups_stats_fc_dict]}})
groups_stats_fc_json

groups_stats_item_properties = {'title': 'AGOL Group Statistics',
'description':'AGOL Group Statistics' ,
'tags': 'arcgis ,python, api, pandas, csv',
'text':groups_stats_fc_json,
'type':'Feature Collection'}
group_stats_item = gis.content.add(groups_stats_item_properties)
group_stats_item

 

The item is created but when I try to access it nothing shows up...

Any ideas?

Reply
0 Kudos
2 Replies
by Esri Contributor
Esri Contributor

Hi again Asaf!

I suspect there's an issue with the dataframe being passed in. Have you verified that the dataframe is valid and being imported correctly? When you call groups_stats_fc does it return <FeatureCollection>? You should also verify that groups_stats_fc_dict is valid.

Here's some more info on the import_data method: arcgis.gis module — arcgis 1.8.2 documentation 

Reply
0 Kudos
Occasional Contributor

Joshua,

The dataframe seems to be valid.

When I call the groups_stats_fc it returns <FeatureCollection> and the groups_stats_fc_dict seems to be valid as well:

Any other ideas?

Reply
0 Kudos