When I'm calling .to_sql()
on a Pandas series, I get an ImportError
exception:
Exception has occurred: ImportError
DLL load failed: The specified module could not be found.
I imported pandas
and pyodbc
, and I am able to connect to the DB server and read data through .read_sql_query()
as well as use pandas Dataframes elsewhere in the code. It only shows up when I try to call .to_sql()
Pandas version 0.23.4
import pandas as pd
import numpy as np
import pyodbc
conn = pyodbc.connect('Driver={SQL Server};Server=' + prm.DATASOURCE + ';DATABASE=' + prm.DATABASE + ';UID=' + prm.USER + ';PWD=' + prm.PASSWORD)
df.to_sql('table_name', conn, if_exists='append', index=True, index_label=['country_id','year_id'])
Thank you