我如何从Python上访问bluescience上的数据?

2024-10-03 17:23:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我想复制一个文件到DSX上的本地内存,这样我就可以使用read_cvcsv创建pandas数据帧。我不想使用给定的“insert to code”选项,因为它假定列标题,而且不适合编写代码。这是我的代码:

import swiftclient

IBM_Objectstorage_Connection = swiftclient.Connection(key=objStorCred['password'],
                                                  authurl=objStorCred['auth_url'],
                                                  auth_version='3',
                                os_options={"project_id": objStorCred['projectId'],
                                            "user_id": objStorCred['userId'],
                                            "region_name": objStorCred['region']})

x = IBM_Objectstorage_Connection.get_account()

我已经尝试过对象存储管理员凭据和容器的凭据。都没用。我试图复制在this教程中所做的,但它似乎不起作用。这是我的错误:

^{pr2}$

任何帮助将不胜感激!在


Tags: 文件内存代码authidpandasreadconnection
1条回答
网友
1楼 · 发布于 2024-10-03 17:23:46

您看过下面的笔记本中提到的get_file_content(credentials)方法了吗:

https://apsportal.ibm.com/analytics/notebooks/461e1a46-243c-4264-98fb-653884ed27f5/view?access_token=e5eb80cb75eae7e2d8ac4306eece1d1345a6c59a180eb284fb79aa04d3ccb7fe

content_string = get_file_content(credentials_1)
precipitation_df = pd.read_csv(content_string)

我以前用过很多次。希望这有帮助。在

相关问题 更多 >