Simple number formatting for python inspired by the scales package in R. prettynum is lightweight and has not third party library dependencies.
pip install prettynum>>>fromprettynumimportcomma, dollar>>>comma(1000)
'1,000'>>>comma(1000, 3)
'1,000.000'>>>comma(1000.89, 1)
'1,000.9'>>>dollar(1000)
'$1,000'>>>dollar(1000, 3)
'$1,000.000'>>>dollar(1000.89, 1)
'$1,000.9'