Vertica python не может загрузить данные смешанного типа - PullRequest
0 голосов
/ 13 апреля 2020

У меня проблемы с записью данных в vertica с pandas dataframe

Ниже приведен мой код,

df = pd.DataFrame({'States':['CA', 'NY'],
                  'Value':[1,2]})

df_dict = {}
for i,j in zip(df.columns, df.dtypes):
    if "object" in str(j):
        df_dict.update({i: sa.types.VARCHAR})

# ### use if_exists='append' if you don't want to create a new table
df.to_sql('hit', v_conn2, schema = 'abcd', if_exists = 'replace', index = False, dtype = df_dict)

Ошибка, которую я продолжаю получать,

ValueError: States (<class 'sqlalchemy.sql.sqltypes.VARCHAR'>) not a string

Спасибо

...