如果这个问题听起来很愚蠢,那么我很抱歉。我正在合并两个csv文件,并且合并的csv文件有一个字段,其中包含逗号和该字段中的值。如何在特定字段中的所有值周围插入引号?在字段中插入引号
import pandas as pd
first = pd.read_csv('C:/datainput')
first['project_id'] = 2
second = pd.read_csv('C:/datainputting')
second['project_id'] = 1
merged = pd.concat([first, second], ignore_index = True)
getting_away = merged.to_csv('C:/datainputcombination.csv', index=False)
for row in getting_away:
row[23] = "'%s'" % row[23]
print "Data Input all ready to fire"
错误:
Traceback (most recent call last):
File "C:/Users/datainputcombo.py", line 14, in <module>
for row in getting_away:
TypeError: 'NoneType' object is not iterable
行[23]:
AGG Development, LLC
RRR Regional, PLLC
RJH Developers, LLC
....................