尝试使用python

时间:2017-11-14 22:45:09

标签: python mysql database python-2.7 csv

def ICP():
    path = r'C:/Users/Desktop/ICP'
    allFiles = glob.glob(os.path.join(path,"*.csv"))
    frame = pd.DataFrame()
    list_ = []
    for file_ in allFiles:
        df = pd.read_csv(file_,index_col=False, header=2, skipfooter = 2, engine = 'python', sep=",", quotechar = "'")
        list_.append(df)
    frame = pd.concat(list_, ignore_index=True)
    # print (frame)
    # print (frame.columns)
    engine = engineconnect()
    con = engine.connect()
    frame.to_sql(con=engine, name='ICP', if_exists = 'replace')

我编写了这个函数来读取csv中的数据并将其上传到sql数据库。但是我收到了这个错误。 (1059,“标识符名称'标签\ t类型\ t日期时间\ tElement \ tElement标签\ tFlags \ tUnadjusted Data \ tConcentration \ tUnit \ tIntensity \ tConcencen'太长了”)

如何解决这个问题?谢谢!

0 个答案:

没有答案