Comments (5)
Had the same issue when using a virtualenv with Python 2.7. Creating a new one with Python 3.5.1 solved the problem for me.
from prophet.
Here's my version information and the full traceback:
Ubuntu 16.04.1 LTS
Python 3.5.2 |Anaconda 2.4.1 (64-bit)| (default, Jul 2 2016, 17:53:06)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-a76c855f084a> in <module>()
----> 1 m.fit(df)
/home/z/anaconda3/lib/python3.5/site-packages/fbprophet/forecaster.py in fit(self, df)
337 history = self.setup_dataframe(history, initialize_scales=True)
338 self.history = history
--> 339 seasonal_features = self.make_all_seasonality_features(history)
340
341 self.set_changepoints()
/home/z/anaconda3/lib/python3.5/site-packages/fbprophet/forecaster.py in make_all_seasonality_features(self, df)
286 365.25,
287 10,
--> 288 'yearly',
289 ))
290
/home/z/anaconda3/lib/python3.5/site-packages/fbprophet/forecaster.py in make_seasonality_features(cls, dates, period, series_order, prefix)
227 @classmethod
228 def make_seasonality_features(cls, dates, period, series_order, prefix):
--> 229 features = cls.fourier_series(dates, period, series_order)
230 columns = [
231 '{}_{}'.format(prefix, i + 1)
/home/z/anaconda3/lib/python3.5/site-packages/fbprophet/forecaster.py in fourier_series(dates, period, series_order)
216 t = np.array(
217 (dates - pd.datetime(1970, 1, 1))
--> 218 .apply(lambda x: x.days)
219 .astype(np.float)
220 )
/home/z/anaconda3/lib/python3.5/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds)
2167 values = lib.map_infer(values, lib.Timestamp)
2168
-> 2169 mapped = lib.map_infer(values, f, convert=convert_dtype)
2170 if len(mapped) and isinstance(mapped[0], Series):
2171 from pandas.core.frame import DataFrame
pandas/src/inference.pyx in pandas.lib.map_infer (pandas/lib.c:62578)()
/home/z/anaconda3/lib/python3.5/site-packages/fbprophet/forecaster.py in <lambda>(x)
216 t = np.array(
217 (dates - pd.datetime(1970, 1, 1))
--> 218 .apply(lambda x: x.days)
219 .astype(np.float)
220 )
AttributeError: 'numpy.timedelta64' object has no attribute 'days'
I didn't have any issues running this with conda on OSx.
from prophet.
The approaches described in the pandas docs both work for me, but I'm still not sure why it works on my Mac but not on my Linux system.
# to days
In [70]: td / np.timedelta64(1,'D')
Out[70]:
0 31.000000
1 31.000000
2 31.003507
3 NaN
dtype: float64
In [71]: td.astype('timedelta64[D]')
Out[71]:
0 31
1 31
2 31
3 NaN
dtype: float64
from prophet.
@robin-weiss I think you're right. I upgraded to Anaconda2-4.3.0
and it works fine now. The problem seems to be because of an older version of pandas.
from prophet.
I got the same problem on my mac with python2.7.10 + pandas-0.17.1, use pip install -U pandas ; I update my pandas to 0.19.2, and the problem solved
from prophet.
Related Issues (20)
- regressor_coefficients not finding regr_names HOT 1
- sample_model() not loading
- Forecast is off by 1
- Prophet Optimization error HOT 1
- Can't seem to forecast values correctly for future dates (few values are coming zero and few are not matching the historical pattern)
- Facebook Prophet ignores manually passed changepoints
- Prophet not working on Google Cloud Run HOT 1
- While adding regressor receiving error message: TypeError: ufunc 'isnan' not supported for the input types HOT 1
- Prophet not compatible with Pandas 2.0
- If there is no data in holidays
- How to get rid of the time dependance?
- Optimizing the training result
- Alpine - install prophet
- Prophet 1.1.5 saving and loading model leads to incorrect historical data points & possibly prediction HOT 2
- forecasting growth example dataset looking very different from documentation HOT 1
- Prophet add.regressor not picking up regressor significance
- Cannot install package sentence_trasnformers
- New to Prophet HOT 3
- Not getting what I expect from a Cross Validation using monthly data and cutoffs
- prophet.serialize FutureWarning: The behavior of Timestamp.utcfromtimestamp is deprecated...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prophet.