如何在Watson Studio中获取数据资产中我的csv文件的文件路径? [英] how to get the file path to my csv file in data assets in watson studio?

查看:203
本文介绍了如何在Watson Studio中获取数据资产中我的csv文件的文件路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Watson Studio中获取我的csv文件的文件路径.该文件保存在Watson Studio的我的项目数据资产中.我需要的是在jupyter笔记本中读取其内容的文件路径.我正在尝试使用一个简单的python文件读取器,该读取器应读取指定路径中的文件.我尝试使用Watson Studio插入文件凭据,但无法使其正常工作. 当我在IBMognitiveclass.ai平台上运行相同文件时,此方法可以正常工作,但无法在IBM Watson Studio中运行该文件,请帮忙.

I have been trying to get the file path of my csv file in watson studio. The file is saved in my project data assets in watson studio. And all I need is the file path to read its content in a jupyter notebook. I'm trying to use a simple python file reader, that should read a file in a specified path. I have tried using watson studio insert file credentials, but can't get it to work. This works fine when I run the same file in IBM cognitiveclass.ai platform, but I can't get this to work in IBM watson studio, please help.

文件名为enrollments.csv

file name is enrollments.csv

import unicodecsv
with open('enrollments.csv', 'rb') as f:
    reader = unicodecsv.DictReader(f)
    enrollments = list(reader)

推荐答案

我假设您的意思是将"enrollments.csv"文件上传到文件"部分. 这会将文件上载到Cloud Object Storage服务的存储桶,该存储用于您的项目. 您可以使用project-lib来获取文件url.

I assume you mean uploaded the "enrollments.csv" file to Files section. This uploads file to the Bucket of Cloud Object Storage service which storage for your project. You can use project-lib to fetch the file url.

# Import the lib
from project_lib import Project
project = Project(sc,"<ProjectId>", "<ProjectToken>")

# Get the url
url = project.get_file_url("myFile.csv")

有关更多信息,请参考: https://dataplatform.cloud.ibm. com/docs/content/analyze-data/project-lib-python.html

For more refer this:- https://dataplatform.cloud.ibm.com/docs/content/analyze-data/project-lib-python.html

https://dataplatform.cloud.ibm.com/analytics/notebooks/v2/a972effc-394f-4825-af91-874cb165dcfc/view?access_token=ee2bd90bee679afc278cdb23453946a3922c454a6a7037e4bd3c4b0f90eb0924

这篇关于如何在Watson Studio中获取数据资产中我的csv文件的文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆