0

I look for this information everywhere but no luck so far. Is it even possible? I read in a old post it might be a NumPy bug, but has it been fixed?

I used zfill(2) successfully for other Python applications not related with NumPy, but when I tried it with my array, it said "numpy.float64 object has no attribute 'zfill'". Any ideas how to change to 2 decimals in a NumPy array that is type numpy.float64 in Python? I am trying to show rates in my array and having so many decimals makes no sense.

eurojourney
  • 71
  • 1
  • 9
  • do you mean zero padding as in '2' to '02'? If you are working with float, you can't have that zero padding. You need to work with string – Osman Mamun Nov 17 '19 at 03:43
  • Does this answer your question? [How to pretty-print a numpy.array without scientific notation and with given precision?](https://stackoverflow.com/questions/2891790/how-to-pretty-print-a-numpy-array-without-scientific-notation-and-with-given-pre) – Craig Nov 17 '19 at 03:44
  • Also related: https://stackoverflow.com/questions/21008858/formatting-floats-in-a-numpy-array/21009774#21009774 – Craig Nov 17 '19 at 03:45
  • Not sure about the zero padding, I am new to programing and python, just started learning a few months back. I want to have in my NumPy.array only 2 decimals because the array represent rates in this fashion $X.XX but now I have a bunch of decimals that I don't need/want to have. – eurojourney Nov 17 '19 at 13:35

0 Answers0