如何将 y 轴格式更改为浮动或其灵敏度? (Pandas 情节)

How to change y axis format to float or its sensitivity ? (Pandas plot)

数据;

anahtar_tarih
2017-12-31    99.7131646900
2018-01-15    99.7032566000
2018-01-31    99.7043161400
2018-02-15    99.6793628400
2018-02-28    99.6793627900
                  ...      
2021-12-15    99.9166534100
2021-12-31    99.9166573800
2022-01-15    99.9346317600
2022-01-31    99.9342393100
2022-02-15    99.9605692600
Name: rate, Length: 108, dtype: object

这是我的基本代码;

df.rate.astype(int).plot(figsize=(10, 10))
plt.suptitle('Rate Graphic')
plt.show()

剧情如下;

通常灵敏度比绘图本身大得多,我怎样才能提高 y 轴上的灵敏度?

对于 ex,它显示 99.8,但我想在点后显示 1 个以上的数字。因为我的数据集就像; 99.7131646900 等等

我该怎么做? 谢谢,

您可以使用 StrMethodFormatter:

from matplotlib.ticker import StrMethodFormatter

df.rate.astype(int).plot(figsize=(10, 10))

plt.gca().yaxis.set_major_formatter(StrMethodFormatter('{x:,.2f}')) # 2 decimal places
plt.show()