I was executing this code when i encountered this error related to file not found. File exists in the same folder where code resides, bu still this error is not going. Please help!
code:
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
from matplotlib.finance import candlestick_ohlc
import matplotlib.dates as mdates
import pandas as pd
import pandas_datareader.data as web
import numpy as np
style.use('ggplot')
df= pd.read_csv('nse2.csv', parse_dates=True, index_col=0)
df_ohlc= df['close'].resample('10D').ohlc()
df_ohlc.reset_index(inplace=True)
print(df_ohlc.head())
ax1 = plt.subplot2grid((6,1),(0,0), rowspan=5, colspan=1)
ax2 = plt.subplot2grid((6,1),(5,0), rowspan=1, colspan=1, sharex=ax1)
ax1.xaxis_date()
candlestick_ohlc(ax1,df_ohlc.values, width=2, colorup='g')
plt.show()
Here is the Error:
Traceback (most recent call last):
File "F:\Report on Artificial Intelligence\candlestick code\c5.py", line 13, in df= pd.read_csv('nse2.csv', parse_dates=True, index_col=0) File "C:\Program Files\Python35\lib\site-packages\pandas\io\parsers.py", line 498, in parser_f
return _read(filepath_or_buffer, kwds) File "C:\Program Files\Python35\lib\site-packages\pandas\io\parsers.py", line 275, in _read parser = TextFileReader(filepath_or_buffer, **kwds) File "C:\Program Files\Python35\lib\site-packages\pandas\io\parsers.py", line 590, in init self._make_engine(self.engine) File "C:\Program Files\Python35\lib\site-packages\pandas\io\parsers.py", line 731, in _make_engine self._engine = CParserWrapper(self.f, **self.options) File "C:\Program Files\Python35\lib\site-packages\pandas\io\parsers.py", line 1103, in init self._reader = _parser.TextReader(src, **kwds) File "pandas\parser.pyx", line 353, in pandas.parser.TextReader.cinit (pandas\parser.c:3246) File "pandas\parser.pyx", line 591, in pandas.parser.TextReader._setup_parser_source (pandas\parser.c:6111) OSError:
This is the main error
->" File b'nse2.csv' does not exist"