POST
|
Posted this as an issue on the ArcGIS API for Python GitHub site. Recommended change was going from processed_table = df.spatial.to_table('DP05_Pop_Age_Sex_Race') to processed_table = df.spatial.to_table(os.path.join(arcpy.env.workspace, 'DP05_Pop_Age_Sex_Race')) This resulted in the "to_table" functioning again, but all the field names were "sanitized", so needed to set that parameter to False: processed_table = df.spatial.to_table(os.path.join(arcpy.env.workspace, 'DP05_Pop_Age_Sex_Race',),overwrite=True, sanitize_columns=False) arcgis.features module | ArcGIS API for Python
... View more
12-13-2023
11:43 AM
|
0
|
0
|
464
|
POST
|
I have a script that worked perfectly last week...before I upgraded from ArcGIS Pro 2.9.5 to 3.2 (see below script). The script is something that I recreated using help from this post (thank you @jcarlson). The script is run within the python window in Pro. When I re-ran this script this week, after updating to Pro 3.2, the script no longer works. I was able to test it on a workstation that was still on 2.9.5, and it works! So that is pretty clear to me that something has changed from the python/panda libraries between 2.9.5 and 3.2. The error I am getting happens on the last line of the script when I try to write the dataframe to a table. Yes, I know the table does not have any geometry, but this worked in the past and created a fgdb table perfectly. The error I get is: "TypeError: 'field_names' must be string or non empty list or tuple of strings" I am a self-proclaimed hack at python/pandas, so any help is greatly appreciated to get this up and running again. @jcarlson @DanPatterson_Retired import arcpy
arcpy.env.workspace = "N:\ArcShared\Planning\CompPlanUpdate_2025\Data\BellinghamProfile\BhamDataBook_2022.gdb"
arcpy.env.overwriteOutput = True
# Import modules
from arcgis import GIS
import pandas as pd
import requests
import json
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
#TOTAL POPULATION, SEX, AGE & RACE data for Bellingham City
# Submit request to API
response = requests.get('https://api.census.gov/data/2022/acs/acs5/profile?get=NAME,DP05_0001E,DP05_0002E,DP05_0003E,DP05_0005E,DP05_0006E,DP05_0007E,DP05_0008E,DP05_0009E,DP05_0010E,DP05_0011E,DP05_0012E,DP05_0013E,DP05_0014E,DP05_0015E,DP05_0016E,DP05_0017E,DP05_0018E,DP05_0073E,DP05_0079E,DP05_0080E,DP05_0081E,DP05_0082E,DP05_0083E,DP05_0084E,DP05_0085E,DP05_0019E,DP05_0024E&for=place:05280&in=state:53')
# Read response as JSON into dataframe
# First row is column names, skipped for data import
df = pd.DataFrame(response.json()[1:])
# Apply column names from first row
cols = response.json()[0]
column_dict = {}
for c in cols:
column_dict.update({cols.index(c):c})
df.rename(columns=column_dict, inplace=True)
df = df.astype({"NAME": str, "DP05_0001E": int, "DP05_0002E": int, "DP05_0003E": int, "DP05_0005E": int, "DP05_0006E": int, "DP05_0007E": int, "DP05_0008E": int, "DP05_0009E": int, "DP05_0010E": int, "DP05_0011E": int, "DP05_0012E": int, "DP05_0013E": int, "DP05_0014E": int, "DP05_0015E": int, "DP05_0016E": int, "DP05_0017E": int, "DP05_0018E": float,"DP05_0073E": int,"DP05_0079E": int,"DP05_0080E": int,"DP05_0081E": int,"DP05_0082E": int,"DP05_0083E": int,"DP05_0084E": int,"DP05_0085E": int,"DP05_0019E":int,"DP05_0024E":int})
# Export to layer
processed_table = df.spatial.to_table('DP05_Pop_Age_Sex_Race')
... View more
12-11-2023
12:33 PM
|
0
|
3
|
564
|
POST
|
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?
... View more
12-11-2023
10:56 AM
|
0
|
0
|
330
|
POST
|
Josh, I am trying to do something similar with the Census APIs, and this script was hugely helpful! Thank you! For some reason, the script throws an error when I get to the apply data types sections. I copied your script and ran it as is, and still get the error. Do you know why this might be? Below is the error I am getting: File "<string>", line 47 df = df[list[df_dtypes.keys())].astype[df_dtypes] ^ SyntaxError: invalid syntax
... View more
10-31-2023
02:20 PM
|
0
|
0
|
278
|
POST
|
Agree. It should ideally be dynamically updating. Mark as solution (though a poor one!) so that it may help others. Thanks Kate
... View more
04-21-2023
09:25 AM
|
0
|
0
|
543
|
POST
|
In my experience, I have had to right click the hamburger stack and force a refresh. This has worked for me in the past when my data was not updating.
... View more
04-21-2023
07:43 AM
|
0
|
0
|
551
|
POST
|
I am working with ArcGIS for excel, and am recently not able to "add from excel" with the geography location type. I have 26 Neighborhood polygons in a AGOL feature layer that I am trying to display in Excel (using Arcgis for Excel). The excel table has the exact same 26 Neighborhood polygons of the same type (text). The join field in Excel and AGOL is identical type. When I set up the Geography and assign the correct fields and hit "Add to Map", it flashes the table, then disappears and nothing shows up on my map...the connection is not made. Several of us have tried this with multiple datasets, knowing the join fields are of identical type and clean join, and nothing happens in Excel. No features show up, no join happens. This was working perfectly several weeks ago, so we can not figure out what has changed to no longer allow us to connect to and AGOL feature layer in Excel and map data. It just defaults back to the "Add layers to your map to start" screen.
... View more
11-21-2022
04:54 PM
|
3
|
2
|
638
|
POST
|
Thank you for response. We have an organizational account and the "Keep me signed in" is not an option using the ArcGIS organization's URL dropdown. I also tried opening the excel spreadsheet while I am already logged in to AGOL in my browser but it did not recognized that I was already logged in.
... View more
09-07-2022
12:04 PM
|
0
|
0
|
516
|
POST
|
Hi, I have created a excel spreadsheet that incorporates ArcGIS for Excel. It utilizes both excel data and a polygon featureclass from my AGOL account. It works great. I saved my project and closed. When I came back, the map was completely empty and my AGOL connections are all red with "X/s" next to them...I assume since when I opened back up my Excel project it didn't recognize my account and wanted me to sign in again to my AGOL account. I signed in, and still all the AGOL data sources remained red and not connected. The only way to get it working again is to remove all the excel and AGOL connections and rebuild them. Seeing as symbology is not super savy in ArcGIS for Excel, this is a major pain to reconnect all my data and joins and symbolize each time I open up the Excel spreadsheet.
... View more
09-02-2022
12:01 PM
|
0
|
2
|
580
|
POST
|
Yes! Thank you so much Steve! That worked perfectly. Was this a suggested solution from ESRI? Anything to look out for when AGOL gets updates and such? Really grateful for your response. Thank you!!!!
... View more
01-30-2020
11:30 AM
|
1
|
1
|
1123
|
POST
|
I'm creating a map in which I only want to show permits that have been finaled in the last year (or 6 months, etc.) AGOL does not seem to allow the "Is within..." query. This is weird because you can use the "Is within" in Dashboard. Does anyone know how to query a date field in a web map using something other than a hard date? I need to query relative dates.
... View more
01-28-2020
12:03 PM
|
0
|
3
|
1205
|
POST
|
I have a dashboard with a details section that references a hosted table. I have enable attachments and am displaying those images (media) in the details section of my dashboard. For some reason, the image file name shows up and I can't figure out why or how to get rid of it. Any ideas? Here is the dashboard: Operations Dashboard for ArcGIS You can see above the picture of the girl with the umbrella that it shows the file name, "Steampunk.jpg". I can't see anything in the configuration setup to remove this.
... View more
05-17-2019
02:26 PM
|
3
|
3
|
889
|
IDEA
|
This capability is really needed. Otherwise we are copying maps/layouts and unnecessarily bloating our projects. This is pretty insane that it is not already available in PRO.
... View more
01-16-2019
03:14 PM
|
2
|
0
|
2063
|
POST
|
Thanks Kory! Yep that could work too. I have a set of tasks that run to create the legend tables, so adding the sort at the end of the tasks worked too. Just seemed like a simple tweak to the table frames that could make them more powerful/productive Thanks! -Kate
... View more
12-03-2018
04:10 PM
|
0
|
0
|
1960
|
POST
|
That is what I did and it reverted to the old sorting.
... View more
11-30-2018
01:57 PM
|
0
|
2
|
1960
|
Title | Kudos | Posted |
---|---|---|
3 | 11-21-2022 04:54 PM | |
1 | 11-30-2018 01:49 PM | |
1 | 11-30-2018 01:33 PM | |
1 | 01-30-2020 11:30 AM | |
3 | 05-17-2019 02:26 PM |
Online Status |
Offline
|
Date Last Visited |
12-13-2023
11:44 AM
|