在使用to_sql寫入數據庫時,出現報錯
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1241, 'Operand should contain 1 column(s)')
是由於dataframe中存在值爲列表的情況,需要將列表轉爲字符串
df.loc[:, ‘xxxx’] = df_main[‘xxxx’].astype(str)
在使用to_sql寫入數據庫時,出現報錯
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1241, 'Operand should contain 1 column(s)')
是由於dataframe中存在值爲列表的情況,需要將列表轉爲字符串
df.loc[:, ‘xxxx’] = df_main[‘xxxx’].astype(str)
繼續運行 🥋 回憶上次內容 上上次 真寫了 萬行 代碼 這 萬行 代碼 都是寫在 明面 上的 這次 使用git命令 下載了 github上面的倉庫