【发布时间】:2021-12-25 22:14:56
【问题描述】:
我想在下面的 Pandas 绘图函数中指定 y_label,但似乎语法不正确。
row = df.iloc[0].astype(int)
row.value_counts().reindex().plot(ylabel='something').bar()
因为错误是
bar() missing 2 required positional arguments: 'x' and 'height'
如果我使用row.value_counts().reindex().plot().bar(),没有问题,但也没有y_label。我该如何解决?
【问题讨论】:
-
row.value_counts().reindex().plot(kind='bar')工作吗? -
@JoshFriedlander:是的,它有效。