1

I am trying to load a csv file within a data frame based in pandas. I have used the following imports.

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd  

It is throwing error that file is not found the traceback is as follows:

FileNotFoundError Traceback (most recent call last) in () ----> 1 df = pd.read_csv('purchases.csv')

c:\users\saish\appdata\local\programs\python\python35-32\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, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision) 703 skip_blank_lines=skip_blank_lines) 704 --> 705 return _read(filepath_or_buffer, kwds) 706 707 parser_f.name = name

c:\users\saish\appdata\local\programs\python\python35-32\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds) 443 444 # Create the parser. --> 445 parser = TextFileReader(filepath_or_buffer, **kwds) 446 447 if chunksize or iterator:

c:\users\saish\appdata\local\programs\python\python35-32\lib\site-packages\pandas\io\parsers.py in init(self, f, engine, **kwds) 812 self.options['has_index_names'] = kwds['has_index_names'] 813 --> 814 self._make_engine(self.engine) 815 816 def close(self):

c:\users\saish\appdata\local\programs\python\python35-32\lib\site-packages\pandas\io\parsers.py in _make_engine(self, engine) 1043 def _make_engine(self, engine='c'): 1044 if engine == 'c': -> 1045 self._engine = CParserWrapper(self.f, **self.options) 1046 else: 1047 if engine == 'python':

c:\users\saish\appdata\local\programs\python\python35-32\lib\site-packages\pandas\io\parsers.py in init(self, src, **kwds) 1682
kwds['allow_leading_cols'] = self.index_col is not False 1683 -> 1684 self._reader = parsers.TextReader(src, **kwds) 1685 1686 # XXX

pandas_libs\parsers.pyx in pandas._libs.parsers.TextReader.cinit()

pandas_libs\parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: File b'purchases.csv' does not exist

3
  • 1
    Are you super sure the file exists? Try df = pd.read_csv(r'purchases.csv') if you are. Commented Nov 21, 2017 at 18:07
  • 1
    Do you have a question? Commented Nov 21, 2017 at 18:08
  • @SuperStew I have tried that it is throwing the same error. Commented Nov 21, 2017 at 19:17

1 Answer 1

0

Used command pwd to get the working directory and then placed the csv file along with the .ipynb file in the same directory.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.