import sqlite3
import pandas as pd
db=sqlite3.connect('School.sqlite') //School.sqlite is a files name
data=pd.read_sql_query("select * from student",db)
data["Address"]="TEST" // adding new column in data dataframe
//Student table is already exists
data.to_sql('Student',db,if_exists='replace') // this line show error
//error show: OperationalError: table "Student" already exists
根据我的理解,我写了正确的代码,但它仍然显示错误,
1条答案
按热度按时间hjzp0vay1#
在sqlite数据库的
to_sql
方法中,表名参数是case sensitive。