Open SpaceDustPi opened 2 years ago
Hi, I am trying to follow your tutorial: https://towardsdatascience.com/how-to-use-machine-learning-to-possibly-become-a-millionaire-predicting-the-stock-market-33861916e9c5
I am using Jupyter Notebooks, python 3.6, on Windows 10. After enter the following code:
import stocker from stocker import Stocker goog = Stocker('GOOGL') goog.plot_stock()
Everything works, but then the next line:
model, model_data = goog.create_prophet_model(days=90)
I get a ValueError:
C:\Users\benki\.conda\envs\myenv\lib\site-packages\pystan\misc.py:399: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. elif np.issubdtype(np.asarray(v).dtype, float): --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-23-0dedf473e878> in <module> ----> 1 model, model_data = goog.create_prophet_model(days=90) ~\Desktop\yolov3-tf2\Data-Analysis\stocker\stocker.py in create_prophet_model(self, days, resample) 516 # Make and predict for next year with future dataframe 517 future = model.make_future_dataframe(periods=days, freq="D") --> 518 future = model.predict(future) 519 520 if days > 0: ~\.conda\envs\myenv\lib\site-packages\fbprophet\forecaster.py in predict(self, df) 1040 df['trend'] = self.predict_trend(df) 1041 seasonal_components = self.predict_seasonal_components(df) -> 1042 intervals = self.predict_uncertainty(df) 1043 1044 # Drop columns except ds, cap, floor, and trend ~\.conda\envs\myenv\lib\site-packages\fbprophet\forecaster.py in predict_uncertainty(self, df) 1242 Dataframe with uncertainty intervals. 1243 """ -> 1244 sim_values = self.sample_posterior_predictive(df) 1245 1246 lower_p = 100 * (1.0 - self.interval_width) / 2 ~\.conda\envs\myenv\lib\site-packages\fbprophet\forecaster.py in sample_posterior_predictive(self, df) 1206 iteration=i, 1207 s_a=component_cols['additive_terms'], -> 1208 s_m=component_cols['multiplicative_terms'], 1209 ) 1210 for key in sim_values: ~\.conda\envs\myenv\lib\site-packages\fbprophet\forecaster.py in sample_model(self, df, seasonal_features, iteration, s_a, s_m) 1274 1275 beta = self.params['beta'][iteration] -> 1276 Xb_a = np.matmul(seasonal_features.values, beta * s_a) * self.y_scale 1277 Xb_m = np.matmul(seasonal_features.values, beta * s_m) 1278 ~\.conda\envs\myenv\lib\site-packages\pandas\core\series.py in __array_wrap__(self, result, context) 502 """ 503 return self._constructor(result, index=self.index, --> 504 copy=False).__finalize__(self) 505 506 def __array_prepare__(self, result, context=None): ~\.conda\envs\myenv\lib\site-packages\pandas\core\series.py in __init__(self, data, index, dtype, name, copy, fastpath) 264 raise_cast_failure=True) 265 --> 266 data = SingleBlockManager(data, index, fastpath=True) 267 268 generic.NDFrame.__init__(self, data, fastpath=True) ~\.conda\envs\myenv\lib\site-packages\pandas\core\internals.py in __init__(self, block, axis, do_integrity_check, fastpath) 4400 if not isinstance(block, Block): 4401 block = make_block(block, placement=slice(0, len(axis)), ndim=1, -> 4402 fastpath=True) 4403 4404 self.blocks = [block] ~\.conda\envs\myenv\lib\site-packages\pandas\core\internals.py in make_block(values, placement, klass, ndim, dtype, fastpath) 2955 placement=placement, dtype=dtype) 2956 -> 2957 return klass(values, ndim=ndim, fastpath=fastpath, placement=placement) 2958 2959 # TODO: flexible with index=None and/or items=None ~\.conda\envs\myenv\lib\site-packages\pandas\core\internals.py in __init__(self, values, placement, ndim, fastpath) 118 raise ValueError('Wrong number of items passed %d, placement ' 119 'implies %d' % (len(self.values), --> 120 len(self.mgr_locs))) 121 122 @property ValueError: Wrong number of items passed 844, placement implies 30`
Have you bee able to debug or side step this issue? I've found many repos are created once and never used again, I'm more on the only repo what you need and update with active community
Hi, I am trying to follow your tutorial: https://towardsdatascience.com/how-to-use-machine-learning-to-possibly-become-a-millionaire-predicting-the-stock-market-33861916e9c5
I am using Jupyter Notebooks, python 3.6, on Windows 10. After enter the following code:
Everything works, but then the next line:
I get a ValueError: