DataFrame to_json(‘gs://bucket/path’)无法工作。

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

DataFrame to_json('gs://bucket/path') does not work

问题

我正在使用GCP VM进行工作。
我想在Python中使用以下命令:

X.to_json("gs://bucket/path")

(在我的本地机器和同事的GCP VM上都可以工作)

然而,我遇到了以下错误[Errno 2] No such file or directory: 'gs://bucket/path...

我可以使用pd.read_json("gs://...")命令从gs中读取文件,但是我无法写入。此外,VM的访问范围是:

"允许对所有云API进行完全访问"

你知道这里的问题是什么吗?

编辑:

我不得不升级pandas版本。问题已解决。

英文:

I am being working on a GCP VM.
I'd like to use the command in python

X.to_json("gs://bucket/path")

(which works on my local machine and on a colleague GCP VM)

However I have the following error [Errno 2] No such file or directory: 'gs://bucket/path...

I can read files from gs with the command pd.read_json("gs://...") but I cannot write. Moreover, the access scope of the VM is :

"Allow full access to all Cloud APIs"

Do you know what is the problem here?

Edit :

I had to upgrade pandas version. The problem is solved

答案1

得分: 1

作为一个社区wiki回答。根据你在问题中的编辑,将相同的内容作为答案发布,以便帮助其他遇到类似问题的成员。

可能较新版本的pandas包含了与GCS集成相关的改进或错误修复。因此,升级pandas版本可以解决这些兼容性问题。

请参考此链接:升级Pandas版本到最新或指定版本

英文:

Answering this as a community wiki. As you edited in your question, posting the same as an answer so other members who are facing this similar issue are helped out.

It's possible that the newer version of pandas includes improvements or bug fixes related to GCS integration. So upgrading pandas version resolve these compatibility issues.

Refer this link on Upgrade Pandas Version to Latest or Specific Version

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

发表评论

匿名网友

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

确定