如果這個問題聽起來很愚蠢,那麼我很抱歉。我正在合併兩個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
....................