无法通过适应类型'numpy.int64'无法将数据从python插入PostgreSQL

时间:2019-06-26 04:05:25

标签: python postgresql

我无法将数据从python插入PostgreSQL

这是数据类型: CustomerID int32

流派对象

年龄int32

年收入int32

支出得分int32

集群int32

cursor = connection.cursor()
postgres_insert_query = """ Insert into CUSTOMER (ID,Genre,Age,Income,Spending,Cluster) VALUES (%s,%s,%s,%s,%s,&s)"""
i = 0

while i < len(dataset):
    record_to_insert= (dataset.iloc[i,0],dataset.iloc[i,1],dataset.iloc[i,2],dataset.iloc[i,3],dataset.iloc[i,4],dataset.iloc[i,5])
    cursor.execute(postgres_insert_query,record_to_insert)
    i = i + 1
connection.commit()
count = cursor.rowcount
print(count, "Record Insert into Table")

错误: 无法适应类型'numpy.int64'

0 个答案:

没有答案