import pandas as pd
import numpy as np
from fbprophet import Prophet
df = pd.read_csv('tq.txt',header=None,sep='\\s+',usecols=[0,2,])
#print(df.shape)
#print(df.head())
print(type(df))
#print(df[0])
df['ds']=df[0]
df['y'] =df[2]
m = Prophet()
m.fit(df);
future = m.make_future_dataframe(periods=30)
#print(future.tail())
forecast = m.predict(future)
print(forecast)
数据如下
2015-07-17 26 34
2015-07-18 26 34
2015-07-19 25 34
2015-07-21 25 28
2015-07-22 25 29
2015-07-24 26 33
2015-07-25 26 33
2015-07-26 27 36
2015-07-27 27 36
2015-07-28 26 36
2015-07-29 25 34
2015-07-30 25 35
2015-07-31 25 36
2015-08-01 26 36
2015-08-02 26 36
2015-08-03 26 36
2015-08-04 26 36
2015-08-05 25 35
2015-08-06 26 35
2015-08-07 26 32
2015-08-10 25 30
2015-08-11 26 33
2015-08-12 26 34
2015-08-13 26 34
2015-08-14 26 33
2015-08-15 26 33
2015-08-16 26 33
2015-08-18 26 32
2015-08-20 25 34
2015-08-21 25 33
2015-08-22 26 32
2015-08-23 26 32
2015-08-24 25 33
2015-08-25 25 34
2015-08-26 25 33
2015-08-27 25 30
2015-08-28 25 30
2015-08-29 24 28
2015-08-30 23 27
2015-08-31 23 29
2015-09-01 23 27
2015-09-02 24 28
2015-09-03 24 32
2015-09-04 25 32
2015-09-05 25 34
2015-09-06 24 33
2015-09-07 23 31
2015-09-08 23 30
2015-09-09 23 29
2015-09-10 22 29
2015-09-11 22 31
2015-09-12 23 30
2015-09-13 23 26
2015-09-14 23 26
2015-09-15 23 28
2015-09-16 23 28
2015-09-17 23 29
2015-09-18 23 29
2015-09-19 23 27
2015-09-20 20 24
2015-09-22 22 26
2015-09-23 24 32
2015-09-24 23 29
2015-09-25 23 28
2015-09-26 22 26
2015-09-27 23 30
2015-09-28 23 29
2015-09-29 24 27
2015-09-30 24 30
2015-10-01 22 31
2015-10-02 21 25
2015-10-03 22 27
2015-10-04 24 28
2015-10-05 24 27
2015-10-06 23 27
2015-10-07 22 26
2015-10-08 21 27
2015-10-09 21 23
2015-10-10 20 24
2015-10-11 18 25
2015-10-12 17 26
2015-10-13 17 25
2015-10-14 17 25
2015-10-15 18 27
2015-10-16 18 27
2015-10-17 18 27
2015-10-18 20 26
2015-10-19 21 25
2015-10-20 21 24
2015-10-21 21 26
2015-10-22 20 28
2015-10-24 19 28
2015-10-25 19 26
2015-10-26 19 28
2015-10-27 20 29
2015-10-30 19 24
2015-10-31 16 19
2015-11-01 16 19
2015-11-03 17 20
2015-11-04 20 23
2015-11-05 21 25
2015-11-06 22 28
2015-11-07 22 31
2015-11-08 22 30
2015-11-09 18 23
2015-11-10 17 20
2015-11-11 17 20
2015-11-12 17 20
2015-11-13 19 26
2015-11-14 18 22
2015-11-15 19 24
2015-11-16 20 25
2015-11-17 21 28
2015-11-18 20 29
2015-11-19 19 24
2015-11-20 20 25
2015-11-21 20 24
2015-11-22 19 24
2015-11-23 18 26
2015-11-24 17 25
2015-11-25 12 21
2015-11-26 9 17
2015-11-27 10 16
2015-11-28 12 18
2015-11-29 15 19
2015-11-30 16 18
2015-12-01 16 20
2015-12-02 15 22
2015-12-03 13 18
2015-12-04 13 17
2015-12-05 11 15
2015-12-06 10 15
2015-12-07 12 17
2015-12-08 13 16
2015-12-09 14 16
2015-12-10 13 21
2015-12-11 13 18
2015-12-12 13 17
2015-12-13 13 17
2015-12-14 14 17
2015-12-15 10 16
2015-12-16 7 15
2015-12-17 5 12
2015-12-18 6 13
2015-12-19 10 15
2015-12-20 13 18
2015-12-21 15 18
2015-12-22 15 18
2015-12-23 15 18
2015-12-24 13 17
2015-12-25 12 15
2015-12-26 12 15
2015-12-27 10 14
2015-12-28 9 15
2015-12-29 9 14
2015-12-30 10 15
2015-12-31 9 15
2016-01-01 10 16
2016-01-02 12 21
2016-01-03 14 21
2016-01-04 15 22
2016