Referring the following guide, I created a Notebook in Watson Studio which upload data to the project's IBM Cloud Object Storage Bucket. The file was added to the project's bucket, but it was not added to the project's Data Asset tab.
Working With IBM Cloud Object Storage In Python https://medium.com/ibm-data-science-experience/working-with-ibm-cloud-object-storage-in-python-fe0ba8667d5f
How can I add a data to Data Asset tab in the project by Notebook?
Notebook
credentials = {
'IBM_API_KEY_ID': 'xxx',
'IAM_SERVICE_ID': 'xxx',
'ENDPOINT': 'xxx',
'IBM_AUTH_ENDPOINT': 'xxx',
'BUCKET': 'xxx',
'FILE': 'xxx.csv'
}
from ibm_botocore.client import Config
import ibm_boto3
cos = ibm_boto3.client(service_name='s3',
ibm_api_key_id=credentials['IBM_API_KEY_ID'],
ibm_service_instance_id=credentials['IAM_SERVICE_ID'],
ibm_auth_endpoint=credentials['IBM_AUTH_ENDPOINT'],
config=Config(signature_version='oauth'),
endpoint_url=credentials['ENDPOINT'])
df_data_1.to_csv("shimac_test_before_upload.csv", encoding="utf-8")
with open('shimac_test_before_upload.csv', 'rb') as data:
cos.upload_fileobj(data, credentials['BUCKET'], 'shimac_test_afer_upload.csv')
Answer by Charles C Gomes (121) | Apr 02, 2018 at 05:21 PM
Hi,
You can use project-lib Library to save the dataframe directly as data asset in your project.
#Save dataframe as csv file to storage
project.save_data(data=df.to_csv(index=False),file_name='iris1.csv',overwrite=True)
For full reference, check this:- https://medium.com/ibm-data-science-experience/control-your-dsx-projects-using-python-c69e13880312
Thanks, Charles.
Error opening workbook in DSX 0 Answers
error in installing watson-machine-learning-client 1 Answer
Unable to initialise the dynamic dashboard API due to frame-ancestors Security Policy Directive 2 Answers
How can I get dashboardSpec information? 4 Answers
What is Dynamic Dashboard Embedded? 1 Answer