Gnar_POW
Gnar_POW

Reputation: 47

How do I read in a CSV file hosted on IBM Skills Network using pandas?

I am getting a "FileNotFoundError". I have searched through most of the related questions and still can't figure it out. I am wondering if it has something to do with the fact that I am using Jupyter Notebooks hosted on IBM Skills Network Lab.

I am pretty certain my file path is correct. I am using Python 3.6.

Anyways, here is my code:

import pandas as pd

df = pd.read_csv(r'E:\user117787937_workout_history (1).csv')
print (df)


---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-14-f905358c1104> in <module>
      1 import pandas as pd
      2 
----> 3 df = pd.read_csv(r'E:\user117787937_workout_history (1).csv')
      4 print (df)

~/conda/envs/python/lib/python3.6/site-packages/pandas/io/parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
    674         )
    675 
--> 676         return _read(filepath_or_buffer, kwds)
    677 
    678     parser_f.__name__ = name

~/conda/envs/python/lib/python3.6/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
    446 
    447     # Create the parser.
--> 448     parser = TextFileReader(fp_or_buf, **kwds)
    449 
    450     if chunksize or iterator:

~/conda/envs/python/lib/python3.6/site-packages/pandas/io/parsers.py in __init__(self, f, engine, **kwds)
    878             self.options["has_index_names"] = kwds["has_index_names"]
    879 
--> 880         self._make_engine(self.engine)
    881 
    882     def close(self):

~/conda/envs/python/lib/python3.6/site-packages/pandas/io/parsers.py in _make_engine(self, engine)
   1112     def _make_engine(self, engine="c"):
   1113         if engine == "c":
-> 1114             self._engine = CParserWrapper(self.f, **self.options)
   1115         else:
   1116             if engine == "python":

~/conda/envs/python/lib/python3.6/site-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
   1889         kwds["usecols"] = self.usecols
   1890 
-> 1891         self._reader = parsers.TextReader(src, **kwds)
   1892         self.unnamed_cols = self._reader.unnamed_cols
   1893 

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: [Errno 2] File E:\user117787937_workout_history (1).csv does not exist: 'E:\\user117787937_workout_history (1).csv'

Upvotes: 1

Views: 1143

Answers (2)

Gnar_POW
Gnar_POW

Reputation: 47

I ended up downloading Anaconda to host Jupyter Notebook which allowed me to interact with the files that I needed instead of using the skills lab network.

If anyone else encounters this problem they can do the same by following this link - https://www.anaconda.com/products/individual

Upvotes: 0

Joshua
Joshua

Reputation: 136

Since you are using IBM skills network lab you need to upload your file(.csv) into IBM skills network lab(Manage Data>>My Data>>Upload data). Then you can able to open the data file using jupyter notebook in IBM SKILLS NETWORK LAB. For more information about uploading data into IBM SKILLS NETWORK LAB: https://cognitiveclass.ai/courses/data-science-hands-open-source-tools-2.

Upvotes: 2

Related Questions