The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

loading of csv file to my notekbook and getting error

loading of csv file to my notekbook and getting error

0
Votes
2
Answer

please how do i load my csv file save on the desktop into my jupyter notebook cause i tried it the same way i saw the tutor did and i got error message 

Start your code here
data = pd.read_csv('1.01. Simple linear regression.csv')
Error message 
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-8-0c537d0c5b39> in <module>
----> 1 data = pd.read_csv('1.01. Simple linear regression.csv')

~\Anaconda3\lib\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

~\Anaconda3\lib\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:

~\Anaconda3\lib\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):

~\Anaconda3\lib\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":

~\Anaconda3\lib\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 1.01. Simple linear regression.csv does not exist: '1.01. Simple linear regression.csv'
2 Answers

365 Team
0
Votes

Hi Oberewu,

Are you sure that the Jupyter notebook file and the dataset are in the same folder? Usually that’s the easiest way to approach the issue.
However, if you still have a problem with that, then you can use the absolute path of a file when loading the data.

Thus, you can write: data = pd.read_csv(‘ABSOLUTE_PATH/1.01. Simple linear regression.csv’)

To me this looks like: data = pd.read_csv(‘C:/Users/365/Desktop/Advanced_Statistical_Methods_(Machine_Learning)/1.01. Simple linear regression.csv’)

In your case, you can find that by opening the folder containing the files and copy-pasting the path.

Once you copy-paste this path, you should CHANGE ALL SLASHES from backward to forward.

This means that if your path is C:\Users\YOUR_COMPUTER_NAME\Desktop\… , you should make it look like: C:/Users/YOUR_COMPUTER_NAME/Desktop/…

Note that, due to the standards for referencing paths, in Python, instead of a backward slash ( \ ), you should use a forward slash ( / ).

0
Votes

…Just find the path of your file, and follow the directives given by the 365 Team, especially, remembering to change the backward slash (\) into forward slash(/), and it will be done…