Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 导致错误消息的原因是什么';多行字符串中的EOF';在google colab中尝试sqlite时?_Python_Sqlite_Jupyter Notebook_Google Colaboratory - Fatal编程技术网

Python 导致错误消息的原因是什么';多行字符串中的EOF';在google colab中尝试sqlite时?

Python 导致错误消息的原因是什么';多行字符串中的EOF';在google colab中尝试sqlite时?,python,sqlite,jupyter-notebook,google-colaboratory,Python,Sqlite,Jupyter Notebook,Google Colaboratory,我试图在GoogleColab中运行以下代码,但收到错误“EOF in multi line string” import sqlite3 from google.colab import files uploaded = files.upload() #upload file Db-IMDB.db connection = sqlite3.connect('./Db-IMDB.db') Yash = pd.read_sql_query("""SELECT da.* FROM (SELECT

我试图在GoogleColab中运行以下代码,但收到错误“EOF in multi line string”

import sqlite3
from google.colab import files
uploaded = files.upload()
#upload file Db-IMDB.db
connection = sqlite3.connect('./Db-IMDB.db')


Yash = pd.read_sql_query("""SELECT da.*
FROM (SELECT pd.pid, pd.name as Director, pa.pid, pa.name as actor, COUNT(*) as cnt,
             RANK() OVER (PARTITION BY pa.pid ORDER BY COUNT(*) DESC) as seqnum,
             COUNT(*) OVER (PARTITION BY pa.pid, COUNT(*)) as num_with_cnt,
      FROM M_director d JOIN
           Person pd
           ON pd.pid = d.pid JOIN
           M_cast c
           ON c.MID = d.MID JOIN
           Person pa
           ON pa.PID = c.PID
      GROUP BY pd.pid, pd.name, pa.pid, pa.name
     ) da
WHERE director = 'Yash Chopra' AND
      seqnum = 1 AND
      num_with_cnt = 1;""",connection)

print(Yash)
我曾经查看过其他用户发布的关于此错误的查询,从我所看到的情况来看,这总是由于缺少一个撇号
,但是,我检查了我的代码,没有遗漏任何代码。你能帮我找出错误的原因吗

我的推荐人:

完全错误:

ERROR:root:An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 23))

---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pandas/io/sql.py in execute(self, *args, **kwargs)
   1430             else:
-> 1431                 cur.execute(*args)
   1432             return cur

OperationalError: near "(": syntax error

During handling of the above exception, another exception occurred:

DatabaseError                             Traceback (most recent call last)
5 frames
/usr/local/lib/python3.6/dist-packages/pandas/io/sql.py in execute(self, *args, **kwargs)
   1429                 cur.execute(*args, **kwargs)
   1430             else:
-> 1431                 cur.execute(*args)
   1432             return cur
   1433         except Exception as exc:

DatabaseError: Execution failed on sql 'SELECT da.*
FROM (SELECT pd.pid, pd.name as Director, pa.pid, pa.name as actor, COUNT(*) as cnt,
             RANK() OVER (PARTITION BY pa.pid ORDER BY COUNT(*) DESC) as seqnum,
             COUNT(*) OVER (PARTITION BY pa.pid, COUNT(*)) as num_with_cnt,
      FROM M_director d JOIN
           Person pd
           ON pd.pid = d.pid JOIN
           M_cast c
           ON c.MID = d.MID JOIN
           Person pa
           ON pa.PID = c.PID
      GROUP BY pd.pid, pd.name, pa.pid, pa.name
     ) da
WHERE director = 'Yash Chopra' AND
      seqnum = 1 AND
      num_with_cnt = 1;': near "(": syntax error

请发布准确的错误消息。它应该有一个行号,并且可能指向错误所在的位置。对不起,我已经发布了完整的错误,它说它接近(',在任何括号之前,我没有发现任何问题sql语法错误是由于使用sqlite版本早于3.25的窗口函数造成的。
as num_with_cnt,as num_with_cnt,
@wildplasser:删除了逗号,仍然得到错误