1. "ImportError: No module named" when trying to run Python script
notebook不知道module的路径在哪,默认只知道current path
先找到包所在位置
pip show --verbose pandas
再告诉notebook
import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages')
2. 安装分解时间序列用到的包
pip install statsmodels
3. AttributeError: 'Index' object has no attribute 'inferred_freq'
seasonal_decompose()对pandas Series需要是datetime
import pandas as pd
from pandas import Series
from matplotlib import pyplot
from statsmodels.tsa.seasonal import seasonal_decompose
df = pd.read_csv('data.csv', header=0)
df.Date = pd.to_datetime(df.Date,errors='coerce')
df = df.set_index('Date')
result = seasonal_decompose(df, model='mutiplicative',freq=7)
result.plot()
pyplot.show()
4. notebook显示图片太小,变大
import matplotlib.pyplot as plt fig_size = [20, 9] plt.rcParams["figure.figsize"] = fig_size
本文由safa 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Inside the C++ Object Model
Stanley B. Lippman / Addison-Wesley Professional / 1996-5-13 / USD 64.99
Inside the C++ Object Model focuses on the underlying mechanisms that support object-oriented programming within C++: constructor semantics, temporary generation, support for encapsulation, inheritanc......一起来看看 《Inside the C++ Object Model》 这本书的介绍吧!