Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I apologize if this has been asked before. I did a search and couldn't find anything.
For example when I use a jupyter notebook through Ananconda Navigator I can read a csv or excel file on my computer. pd.read_csv('./Documents/folder/file.csv')
How do I do that when I use a jpuyter notebook through dss?
Hi @WayneKhan while you wait me a more detailed response, and just incase you haven't accessed it already, I wanted to share with you Using Jupyter Notebooks in DSS from our Knowledge Base. I hope this helps!
Use a Managed Folder to store your file. DSS is not a desktop notebook system and designed to run on servers and on clouds.
folder = dataiku.Folder("myFolder")
with folder.get_download_stream("/accidents_2010.csv") as stream:
df = pd.read_csv(stream)
This works OK for me with a clean CSV file.
Hi @WayneKhan ,
As Mark_Treveil mentioned, the proper way to handle any file in DSS is to add it to a Managed folder first and then utilize Dataiku API to open and process it in any way required. In some rare cases, you may still want to read files from system folders, the example below will give you an idea of how to do that:
import dataiku
from dataiku import pandasutils as pdu
import pandas as pd
import os
#in this example file located in dataiku home directory.
home_directory_path = os.path.expanduser("~")#find dataiku user home directory
local_filename = os.path.join(home_directory_path, "us-500.csv")
print(local_filename)
with open(local_filename, "rb") as f:
df = pd.read_csv(f)
df.head()
Hope this helps,
Vitaliy
Thanks everyone!