watsonx.ai

 View Only
  • 1.  How to refer JSON file in Jupyter notebook

    Posted Tue February 11, 2020 10:34 AM
    Hi, I am new to watson notebook. I have to refer a json file in my Jupyter notebook. Can someone please guide on how to add a file and refer it from my Jupyter notebook. Thanks in advance !


    ------------------------------
    Thanks!
    AMIT LOHAKARE
    ------------------------------

    #WatsonStudio


  • 2.  RE: How to refer JSON file in Jupyter notebook

    Posted Wed March 11, 2020 05:11 PM
    Hi Amit,  Using external files in Watson Studio (WS) in the IBM Cloud is not hard to do but it is not intuitively obvious.  

    Whenever you import a notebook and data assets into a WS project, the data assets (like your JSON file) get placed into Cloud Object Storage (COS).  Once there, your notebook can't access it in the way you did before by just accessing filename.json.

    One way to get the file out of COS is to use the IBM Python project-lilb library:  https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/project-lib-python.html

    That library has functions to read files out of COS and then writing them to the virtual disk used by WS notebooks.  Once written to the disk, you can then access the files using regular Python library functions.

    I've written some guidance and a couple of little functions (cos2file and file2cos) that explain how to incorporate project-lib functions into your notebooks, located here:  http://ibm.biz/notebook-in-studio

    ------------------------------
    Ray Lopez, Ph.D.
    Data Scientist & Enablement Guru
    IBM Data Science & AI
    ray.lopez@us.ibm.com
    ------------------------------



  • 3.  RE: How to refer JSON file in Jupyter notebook

    Posted Sun March 15, 2020 04:05 PM
    Great examples THANK YOU!
    I got a project token, but where does the project_id coming from?
    Thanks


    ------------------------------
    Michael I Hay
    ------------------------------



  • 4.  RE: How to refer JSON file in Jupyter notebook

    Posted Mon March 16, 2020 05:01 AM
    Hi Michael,
    This is hidden in the URL if you click on (open) the project in Watson Studio the URL has the form:
    https://dataplatform.cloud.ibm.com/projects/00000000-0000-0000-0000-000000000000?context=wdp
    Cheers
    Chris

    ------------------------------
    Chris Watson
    ------------------------------