How to format output numbers using Pandas package?

Asked

Viewed 16 times

0

I’m new to Python.

Using "formatters" and Pandas package, how to format the output of a decimal number to the Brazilian standard ?

I did that and it worked, but if there’s any simpler way... {Vendas_media.to_html(formatters={'Average Values': 'R${:-.2f}'.format}). replace('.',','). replace('-','.')}

But for me it got weird these two Places followed, that in theory can be used infinitely? And I also noticed that only replace makes the process of interpreting code much slower (the base table is huge with more than 100,000 lines).

I also wanted to format an entire number to add only the thousands separator, and only got so. {Stock.to_html(formatters={'Quantity': '{:,.0f}'.format}). replace(',','.')}

I read that there are some packages that support the Brazilian monetary standard, but I wanted some suggestion besides the package locale because if in the code above I used '{:.,0f}'. format} would make a mistake in interpreting.

Where is the reference material of formatters?

Thank you very much for your attention.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.