Python-更改底部值的格式以显示月份

时间:2018-11-23 19:50:23

标签: python pandas matplotlib seaborn

python和pandas的新手,我可以通过查找现有代码来使函数正常工作,但是我想将底值从数字更改为实际文本,这种情况下需要几个月的时间。

select jsonb_set(d, '{}', d || '{"age":30,"city":"los angeles"}')

enter image description here

下面是我的表,其中包含月份: enter image description here

1 个答案:

答案 0 :(得分:0)

如果我理解正确,您想从数字[0,1,... 11]更改图的x轴上的标签
到相应月份的名称['January','February',...'December']。

如果是这样,您可以使用以下方法做到这一点:

map((data) => Object.assign(new Piece(), data))

您可以使用# Get the current locations of the labels locations, labels = plt.xticks() # Set the values of the new labels months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] # Place the new labels plt.xticks(locations, labels=months) 模块以较少的硬编码值执行此操作:

calendar