I am using Python in PyCharm to run a script. After I read the excel csv file which gets read I get this error:
Traceback (most recent call last):
File "C:\Users\lolaX\PycharmProjects\Srourcode\Srourcode\main.py", line 245, in <module>
shipmentsdata = pd.read_csv('../input/sample-data-shipments-vehicle-routing-simulation/sampledatatruckrouting2.csv')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\util\_decorators.py", line 211, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\util\_decorators.py", line 331, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\io\parsers\readers.py", line 950, in read_csv
return _read(filepath_or_buffer, kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\io\parsers\readers.py", line 605, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\io\parsers\readers.py", line 1442, in __init__
self._engine = self._make_engine(f, self.engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\io\parsers\readers.py", line 1735, in _make_engine
self.handles = get_handle(
^^^^^^^^^^^
File "C:\Users\lolaX\PycharmProjects\Srourcode\venv\Lib\site-packages\pandas\io\common.py", line 856, in get_handle
handle = open(
^^^^^
**FileNotFoundError: [Errno 2] No such file or directory: '../input/sample-data-shipments-vehicle-routing-simulation/sampledatatruckrouting2.csv'
**
Process finished with exit code 1
I just do not know why the csv file is not seen as the directory. Here is how I read it:
# read csv
truck_data = pd.read_csv(r'C:\Users\lolaX\Desktop\sampledatatruckrouting2.csv')
print(truck_data)
It is reading and outputting the data but I do not know how to fix the error. Please help.
I tried using os and so many other things to fix the error and it did not work.