I am importing excel data into sqlite database with python3 with the below code:
import sqlite3
import pandas as pd
con = sqlite3.connect("test.db")
wb = pd.read_excel("for_DB_data.xlsx", sheet_name=None)
for sheet in wb:
wb.[sheet].to_sql(sheet, con, if_exists="replace", index=False)
con.commit()
con.close()
As result for ID column I get such values:
1.0
2.0
'''
99.0
But I want to see as:
1
2
'''
99
Without .0, whereas my excel ID column filled as:
1
2
'''
99
When I open database with sqlitebrowser in linux I see ID Type as REAL, but I want for ID TYPE to be set as INTEGER. The same I want for other columns which are set to REAL, but I want to be set as INTEGER OR TEXT(some). How can I ask python to set TYPE for ID or some other columns as INTEGER or TEXT while exporting the data into sqlite3 database? Thank you in advance for the help.