簡體   English   中英

如何從Data Science Experience上的Python訪問Bluemix Object Storage上的文件?

[英]How do I access files on Bluemix Object Storage from Python on Data Science Experience?

我想將文件復制到DSX上的本地內存中,以便可以使用read_csv創建熊貓數據框。 我不想使用給定的“插入代碼”選項,因為它假定了列標題,而且代碼也不那么漂亮。 這是我的代碼:

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()

我已經嘗試過對象存儲管理員憑據和容器的憑據。 都不起作用。 我正在嘗試復制教程中所做的操作,但似乎沒有用。 這是我的錯誤:

Authorization Failure. Authorization failed: The resource could not be found. (HTTP 404)

任何幫助將不勝感激!

您是否看過以下筆記本中提到的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)

我已經使用過很多次了。 希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM