SyntaxError: 无效的十进制字面量 (gdrive)

huangapple go评论114阅读模式
英文:

SyntaxError: invalid decimal literal (gdrive)

问题

user_interactions_df = pd.read_csv(https://drive.google.com/uc?export=download&id=1WgjXneyZHGQrxrh1maRyPdbXE3J9wp--)
SyntaxError: invalid decimal literal

enter image description here

Any advice would be helpful.

Thank you in advance.

I just want to run my code!!
First time on stack overflow:)
thanks

英文:
user_interactions_df = pd.read_csv(https://drive.google.com/uc?export=download&id=1WgjXneyZHGQrxrh1maRyPdbXE3J9wp--)
                                                                                  ^

SyntaxError: invalid decimal literal

enter image description here

Any advice would be helpful.

Thank you in advance.

I just want to run my code!!
Firstt time on stack overflow:)
thanks

答案1

得分: 2

read_csv()函数接受一个包含文件路径的字符串参数。

你正在尝试的方法不会起作用,因为pd.read_csv()无法从网址请求文件。请下载.csv文件并将文件路径作为参数传递给函数。

在这里查看pandas的read_csv()文档:https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html

英文:

The read_csv() function takes a string argument containing the file path.

What you are trying to do will not work, as pd.read_csv() can not request the file from a web address. Download the .csv file and pass the file path to the function as an argument.

Check out the pandas read_csv() documentation here: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html

huangapple
  • 本文由 发表于 2023年7月31日 23:51:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76805230.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定