Skip to content

Instantly share code, notes, and snippets.

@alsotang
Created November 12, 2019 11:47
Show Gist options
  • Save alsotang/162037b1add24daa041f6029940c08d1 to your computer and use it in GitHub Desktop.
Save alsotang/162037b1add24daa041f6029940c08d1 to your computer and use it in GitHub Desktop.
2019年天猫双11交易额预测
# coding=utf-8
import numpy as np
x = range(2009, 2019) # 年份
y = [0.5, 9.36, 52, 191, 350, 571, 912, 1207, 1682, 2135] # 2009到2018年的交易额
fittedPara = np.polyfit(x, y, 3) # 进行3次方多项式拟合
fx = np.poly1d(fittedPara)
Y = fx(range(2009, 2020)) # 用历年数据得出的拟合公式,预测2019年的交易额
print Y # 预测结果为 2689亿
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment