计算自相关 (ACF):强制转换为 Unicode:需要字符串或缓冲区,找到浮点数
Calculating Autocorrelation (ACF) : coercing to Unicode: need string or buffer, float found
我想使用 pandas.plotting 中的自相关图来检查时间序列中的随机性。我的数据框如下所示:
DATE reqUser sum_event_count
0 2017-10-08 21:00:00 bddfdpadm 92542.0
1 2017-10-11 06:00:00 bscdpadm 1913.0
2 2017-10-11 11:00:00 ambari-qa 240.0
3 2017-10-11 14:00:00 A454275 6834.0
4 2017-10-13 04:00:00 cdndpadm 20737.0
我试过了:
from pandas.plotting import autocorrelation_plot
autocorrelation_plot(df)
我收到此错误消息:
TypeError: coercing to Unicode: need string or buffer, float found
有什么问题吗?请帮助 ?谢谢 !
我认为需要通过Series
评论。
Autocorrelation plots are often used for checking randomness in time series. This is done by computing autocorrelations for data values at varying time lags. If time series is random, such autocorrelations should be near zero for any and all time-lag separations. If time series is non-random then one or more of the autocorrelations will be significantly non-zero. The horizontal lines displayed in the plot correspond to 95% and 99% confidence bands. The dashed line is 99% confidence band.
from pandas.plotting import autocorrelation_plot
autocorrelation_plot(df['sum_event_count'])
如果需要 time series
添加 set_index
:
from pandas.plotting import autocorrelation_plot
autocorrelation_plot(df.set_index('DATE')['sum_event_count'])
我想使用 pandas.plotting 中的自相关图来检查时间序列中的随机性。我的数据框如下所示:
DATE reqUser sum_event_count
0 2017-10-08 21:00:00 bddfdpadm 92542.0
1 2017-10-11 06:00:00 bscdpadm 1913.0
2 2017-10-11 11:00:00 ambari-qa 240.0
3 2017-10-11 14:00:00 A454275 6834.0
4 2017-10-13 04:00:00 cdndpadm 20737.0
我试过了:
from pandas.plotting import autocorrelation_plot
autocorrelation_plot(df)
我收到此错误消息:
TypeError: coercing to Unicode: need string or buffer, float found
有什么问题吗?请帮助 ?谢谢 !
我认为需要通过Series
评论
Autocorrelation plots are often used for checking randomness in time series. This is done by computing autocorrelations for data values at varying time lags. If time series is random, such autocorrelations should be near zero for any and all time-lag separations. If time series is non-random then one or more of the autocorrelations will be significantly non-zero. The horizontal lines displayed in the plot correspond to 95% and 99% confidence bands. The dashed line is 99% confidence band.
from pandas.plotting import autocorrelation_plot
autocorrelation_plot(df['sum_event_count'])
如果需要 time series
添加 set_index
:
from pandas.plotting import autocorrelation_plot
autocorrelation_plot(df.set_index('DATE')['sum_event_count'])