如何在matplotlib中使用逗号作为千位分隔符打印数字

时间:2014-11-18 09:52:47

标签: python matplotlib

我已经堆积了用逗号分隔的打印数字

import matplotlib.pyplot as plt
from pandas import DataFrame,Series


d = {'Sex' : Series(["Male","Male","Female","Female","Female","Male","Female","Female","Male"]),
      'Rank' : Series(["A","B","C","A","B","C","A","B","C"]),
      'Num_x' : Series([1000,2000,3000,4000,5000,6000,4000,5000,6000]),
    'Num_y' : Series([1,2,3,4,5,6,7,8,9]),
      'States' : Series(["Ohio","Ohio","Ohio","Ohio","Ohio","Ohio","Ohio","Ohio","Ohio"])}

DF = DataFrame(d)

plt.scatter(DF['Num_x'],DF['Num_y'])

感谢阅读

1 个答案:

答案 0 :(得分:1)

您可以使用以下内容准备字符串:

"{:,.02f}".format(123456789.1234324)