I'm trying to read a few hundred tables from ascii and then write them to mySQL. It seems easy to do with Pandas but I hit an error that doesn't make sense to me:
I have a data frame of 8 columns. Here is the column list/index:
metricDF.columns
Index([u'FID', u'TYPE', u'CO', u'CITY', u'LINENO', u'SUBLINE', u'VALUE_010', u'VALUE2_015'], dtype=object)
I then use to_sql
to append the data up to mySQL
metricDF.to_sql(con=con, name=seqFile, if_exists='append', flavor='mysql')
I get a strange error about a column being "nan":
OperationalError: (1054, "Unknown column 'nan' in 'field list'")
As you can see all my columns have names. I realize mysql/sql support for writing appears in development so perhaps that's the reason? If so is there a work around? Any suggestions would be greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…