【问题标题】:CSV forgetting some columns when added to ArcGIS ProCSV forgetting some columns when added to ArcGIS Pro
【发布时间】:2022-12-19 07:15:03
【问题描述】:

In the first photo []. I have all the columns I have desired (which the example I will talking about is Project Scope) in an Excel CSV file. When I go to add the the CSV into ArcPro (second photo) ArcGIS Pro drops the Project Scope column for some reason and it should be in between the Project Phase column and the Construction Finish column []. The CSV was generated using a python script that used Pandas function so that may be a lead on the case.

Has anyone encountered this before? Advice would be appreciated!

I tried creating a python script with pandas that would create an dictionary to bracket the columns(A:O) which Project Scope would be included but this came up to no avail and my issue remained. Here is the code I have

import arcpy
import pandas as pd
import csv

#project plan to csv
df = pd.read_excel(r'original.xlsx', usecols="A:O")

#convert to csv
df.to_csv(r'new.csv')
df = pd.read_csv(r'new.csv')

#generate key field
df["unique_id"] = df["City"] + "<>" + df["Project Status"] + '-' + df["Project Phase"]

df.to_csv(r'new.csv')

#isolate unique id column between new and old columns
with open(r'new.csv', 'w') as infile:
    reader = csv.reader(infile)
    newlist = [rows[15] for rows in reader]
with open(r'old.csv', 'w') as infile:
    reader = csv.reader(infile)
    oldist = [rows[15] for rows in reader]

I tried deleting some unnecessary columns in the CSV before adding the CSV into ArcGIS Pro, which showed the Project Scope field, but dropped other columns that are of importance.

【问题讨论】:

  • You'll need to show the code if you want help with the code.
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.

标签: python pandas list csv arcgis


【解决方案1】:

Project scope has line breaks within. I bet that is causing problems. Look at the actual csv file you are trying to load in a text editor.

【讨论】:

  • i removed the line breaks but still same result. I assert its something to do with the pandas code which is probably missing an extra parameter.
  • Looking at the ArcGIS documentation, max length for a text column is 255 characters. I bet you are hitting that length and the column is getting dropped.
  • That's possible. However it will add the Project Scope column itself but drop other surrounding columns. Maybe thats to make room for it.
猜你喜欢
  • 2022-12-01
  • 1970-01-01
  • 2019-06-27
  • 2021-04-26
  • 1970-01-01
  • 2022-12-26
  • 2017-01-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多