Select to view content in your preferred language

Attempting to save dataframe as table in active ArcGIS Pro workspace

571
4
11-27-2023 10:28 AM
JulianaSpector1
New Contributor III

I am having an issue saving a pandas data frame as a table in the active ArcGIS Pro workspace.

I have converted the entire data frame to string data types using the following line of code:

import pandas

df = df.applymap(str)

When I run the to_table geoprocessing tool, with the following line of code, I receive this error:

import arcpy

import arcpy.sa import *

df.spatial.to_table(location="tbl_name")

TypeError: 'field_names' must be string or non empty sequence of strings

 I have attached a csv file of the data frame for reference. 

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

The first field is missing a field name in the first row.


... sort of retired...
0 Kudos
JulianaSpector1
New Contributor III

Does the index need a field name? I'm not seeing the index show up as a column when running the dtypes argument.

JulianaSpector1_0-1701110519925.png

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

you posted a csv and the error is complaining about a missing name, perhaps you have to provide the field names somewhere


... sort of retired...
0 Kudos
KateNewell1
Occasional Contributor II

I am having the exact same issue. What is interesting for me, is that this worked perfectly in Pro until I just upgraded to 3.2.0

Previous to upgrading my pro version, it worked...now I get the same TypeError. Have you had any luck?

0 Kudos