Prophet 의 `TypeError: float() argument must be a string or a number` 는 `plot` 앞에 `pd.plotting.register_matplotlib_converters()` 를 추가하면 해결된다
Prophet TypeError: float() argument must be a string or a number 는 plot 앞에 pd.plotting.register_matplotlib_converters() 를 추가하면 해결됩니다.
Prophet 의 빠른 시작 사용해보기
import pandas as pd
from fbprophet import Prophet
df = pd.read_csv(
"https://raw.githubusercontent.com/facebook/prophet/master/"
"examples/example_wp_log_peyton_manning.csv"
)
df.head()
ds
y
0
2007-12-10
9.590761
1
2007-12-11
8.519590
2
2007-12-12
8.183677
3
2007-12-13
8.072467
4
2007-12-14
7.893572
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=365)
future.tail()
INFO:fbprophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.
ds
3265
2017-01-15
3266
2017-01-16
3267
2017-01-17
3268
2017-01-18
3269
2017-01-19
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
ds
yhat
yhat_lower
yhat_upper
3265
2017-01-15
8.204005
7.506318
8.897406
3266
2017-01-16
8.529004
7.833604
9.213509
3267
2017-01-17
8.316397
7.598104
9.071751
3268
2017-01-18
8.149020
7.405367
8.816930
3269
2017-01-19
8.160915
7.413687
8.862955
plot 그러면 TypeErrortry:
fig1 = m.plot(forecast)
except TypeError as e:
print(e)
float() argument must be a string or a number, not 'datetime.datetime'

plot 앞에 pd.plotting.register_matplotlib_converters()를 추가하여 해결하기
(Prophet issue 참조)
pd.plotting.register_matplotlib_converters()
plot 성공
fig1 = m.plot(forecast)
Reference
이 문제에 관하여(Prophet 의 `TypeError: float() argument must be a string or a number` 는 `plot` 앞에 `pd.plotting.register_matplotlib_converters()` 를 추가하면 해결된다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/c67e708d/items/27f222b129eb168e2b65
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
import pandas as pd
from fbprophet import Prophet
df = pd.read_csv(
"https://raw.githubusercontent.com/facebook/prophet/master/"
"examples/example_wp_log_peyton_manning.csv"
)
df.head()
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=365)
future.tail()
INFO:fbprophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
try:
fig1 = m.plot(forecast)
except TypeError as e:
print(e)
float() argument must be a string or a number, not 'datetime.datetime'
pd.plotting.register_matplotlib_converters()
fig1 = m.plot(forecast)
Reference
이 문제에 관하여(Prophet 의 `TypeError: float() argument must be a string or a number` 는 `plot` 앞에 `pd.plotting.register_matplotlib_converters()` 를 추가하면 해결된다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/c67e708d/items/27f222b129eb168e2b65텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)