OperationalError: (sqlite3.OperationalError) too many SQL variables, while using SQL with dataframes

匿名 (未验证) 提交于 2019-12-03 01:00:01

问题:

I have a pandas dataframe as below.

       activity         User_Id  \ 0  VIEWED MOVIE  158d292ec18a49    1  VIEWED MOVIE  158d292ec18a49    2  VIEWED MOVIE  158d292ec18a49    3  VIEWED MOVIE  158d292ec18a49    4  VIEWED MOVIE  158e00978d7a6c                                              Media_Title Media_Type User_Rating   0  20th Asian Athletics Championship-2013 Held At...                     NA   1                                 Tu Majha Saangaati                     NA   2                                       Home Cooking                     NA   3                                         Mix Dil Se                     NA   4                  Value, Virtues, Ethics & Morality                     NA 

I am trying to write an SQL query using sqldf package of pandasql as below.

distinct_activity_user = pandasql.sqldf(" select User_Id from pmm_activity", locals()) 

The error i am getting is :

OperationalError: (sqlite3.OperationalError) too many SQL variables [SQL: 'INSERT INTO pmm_activity (activity, "User_Id", "Media_Title", "Media_Type", "User_Rating") VALUES 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!