FraPochetti / StocksProject

Predict Stocks Market Machine Learning
252 stars 131 forks source link

Missing csv file and Error in Execution #1

Open rajarcr opened 9 years ago

rajarcr commented 9 years ago

Hi, Thanks for the wonderful articles and code. I tried to execute the code "python Stocks.py" and see the following errors.

Traceback (most recent call last): File "Stocks.py", line 24, in datasets = loadDatasets('/home/francesco/Dropbox/DSR/Project/datasets') File "my-python/stocks/FraPochettiStocks/functions.py", line 34, in loadDatasets out = pd.read_csv(name, index_col=0, parse_dates=True) File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 470, in parser_f return _read(filepath_or_buffer, kwds) File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 246, in _read parser = TextFileReader(filepath_or_buffer, kwds) File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 562, in init self._make_engine(self.engine) File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 699, in _make_engine self._engine = CParserWrapper(self.f, self.options) File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 1066, in init self._reader = _parser.TextReader(src, **kwds) File "pandas/parser.pyx", line 350, in pandas.parser.TextReader.cinit (pandas/parser.c:3163) File "pandas/parser.pyx", line 583, in pandas.parser.TextReader._setup_parser_source (pandas/parser.c:5779) IOError: File /home/francesco/Dropbox/DSR/Project/datasets/procter.csv does not exist

The file /home/francesco/Dropbox/DSR/Project/datasets/procter.csv seems to be missing. Would you please help me to fix this issue?

Thanks & Regards, Raja

FraPochetti commented 9 years ago

Hello Raja, thanks for taking the time for reading! First of all the lastest version of the project is here https://github.com/FraPochetti/SP-500IndexPythonForecast . As for your error the issue is due to the fact that the program is looking for a file on my local filesystem which is obviously impossible to get. Try getting some procter & gamble data from Yahoo!, save it as a csv file and rerun the code changing the path. Cheers

Francesco

rajarcr commented 9 years ago

Hi Francesco, Thanks a lot for the quick response. I have downloaded the SP-500 data from google and tried to run the market.py ; but still I see some issue as shown below.

Traceback (most recent call last): File "markets.py", line 47, in pystocks.performFeatureSelection(maxdeltas, maxlags, fout, cut, start_test, path_datasets, savemodel, method, folds, parameters)
File "/home/raja/my-python/stocks/SP-500IndexPythonForecast/pystocks.py", line 330, in performFeatureSelection finance = mergeDataframes(datasets, 6, cut) File "/home/raja/my-python/stocks/SP-500IndexPythonForecast/pystocks.py", line 164, in mergeDataframes first = subset[0].join(subset[1:], how = 'outer') File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 3990, in join rsuffix=rsuffix, sort=sort) File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 4023, in _join_compat verify_integrity=True) File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 754, in concat copy=copy) File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 886, in init self.new_axes = self._get_new_axes() File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 959, in _get_new_axes new_axes[self.axis] = self._get_concat_axis() File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1016, in _get_concat_axis self._maybe_check_integrity(concat_axis) File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1025, in _maybe_check_integrity % str(overlap)) ValueError: Indexes have overlapping values: ['0', 'RolMean2', 'Time2', 'seRolMean2']

I believe I'm doing something wrong with the SP-500 data download from google. Would you please help me with the sample data to run?

Thanks & Regards, Raja

andyyuan78 commented 9 years ago

I got the same error!

akshoye commented 7 years ago

Hi Francesco am getting this error can you please help me. /usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/webtunix/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable). warnings.warn(msg, UserWarning) /usr/local/lib/python2.7/dist-packages/sklearn/qda.py:6: DeprecationWarning: qda.QDA has been moved to discriminant_analysis.QuadraticDiscriminantAnalysis in 0.17 and will be removed in 0.19. "in 0.17 and will be removed in 0.19.", DeprecationWarning) /home/webtunix/Desktop/abcd/pystocks.py:137: FutureWarning: pd.rolling_mean is deprecated for Series and will be removed in a future version, replace with Series.rolling(window=2,center=False).mean() dataframe[roll_n] = pd.rolling_mean(dataframe[returns], n) Traceback (most recent call last): File "markets.py", line 47, in pystocks.performFeatureSelection(maxdeltas, maxlags, fout, cut, start_test, path_datasets, savemodel, method, folds, parameters)
File "/home/webtunix/Desktop/abcd/pystocks.py", line 333, in performFeatureSelection finance = mergeDataframes(datasets, 6, cut) File "/home/webtunix/Desktop/abcd/pystocks.py", line 165, in mergeDataframes first = subset[0].join(subset[1:], how = 'outer')
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 4555, in join rsuffix=rsuffix, sort=sort) File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 4588, in _join_compat verify_integrity=True) File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1451, in concat copy=copy) File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1597, in init self.new_axes = self._get_new_axes() File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1685, in _get_new_axes new_axes[self.axis] = self._get_concat_axis() File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1744, in _get_concat_axis self._maybe_check_integrity(concat_axis) File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 1753, in _maybe_check_integrity % str(overlap)) ValueError: Indexes have overlapping values: ['Time2', 'seRolMean2']

smrutis1984 commented 7 years ago

Even i am facing the same issue, any one got any solution for it?