有必要自动构建一系列图表,其中只有一列发生变化。
month_last_price = data.pivot_table(index='month',
values = 'last_price',
aggfunc = 'count').plot(grid=True, figsize=(12, 5))
day_last_price = data.pivot_table(index='weekday',
values = 'last_price',
aggfunc = 'count').plot(grid=True, figsize=(12, 5))
通过函数或循环执行此操作的最佳方法是什么?像这样试过
def super_show(index_data, value_data):
super_show.plot(index = index_data, values = value_data, grid=True, figsize=(12, 5))
super_show('year', 'last_price')
plt.show()
但写道
AttributeError:'function'对象没有属性'plot'
如果我正确理解了这个问题:
称呼: