我一直在绘制一些图,然后我收到以下代码的上述错误:
lag = range(0, 31)
djia_acf = []
for l in lag:
djia_acf.append(djia_df['Close'].autocorr(l))
plt.figure(figsize = (5.5, 5.5))
g = sns.pointplot(x=lag, y=djia_acf, markers = '.')
g.set_title('Autocorrelation function for DJIA')
g.set_xlabel('Lag in terms of number of trading days')
g.set_ylabel('Autocorrelation Function')
g.set_xticklabels(lag, rotation = 90)
TypeError Traceback (most recent call last)
<ipython-input-42-3ca28bdcaeea> in <module>()
1 plt.figure(figsize = (5.5, 5.5))
----> 2 g = sns.pointplot(x=lag, y=djia_acf, markers = '.')
3 g.set_title('Autocorrelation function for DJIA')
4 g.set_xlabel('Lag in terms of number of trading days')
5 g.set_ylabel('Autocorrelation Function')
/home/aspiring1/anaconda3/lib/python3.6/site-packages/seaborn/categorical.py in pointplot(x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, markers, linestyles, dodge, join, scale, orient, color, palette, ax, errwidth, capsize, **kwargs)
3065 estimator, ci, n_boot, units,
3066 markers, linestyles, dodge, join, scale,
-> 3067 orient, color, palette, errwidth, capsize)
3068
3069 if ax is None:
/home/aspiring1/anaconda3/lib/python3.6/site-packages/seaborn/categorical.py in __init__(self, x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, markers, linestyles, dodge, join, scale, orient, color, palette, errwidth, capsize)
1607 """Initialize the plotter."""
1608 self.establish_variables(x, y, hue, data, orient,
-> 1609 order, hue_order, units)
1610 self.establish_colors(color, palette, 1)
1611 self.estimate_statistic(estimator, ci, n_boot)
在上面的代码中,我只是尝试使用 seaborn 绘制点图,但是它给出了范围对象不可调用的错误,我看到了类似的帖子,其中有错误
“列表对象不可调用”
但是,在这里我看不到我的范围对象滞后被调用的任何地方。使用 x = np.array(lag) 给了我所需的图,下面的输出是额外的,不知道为什么?
相关分类