0

I am trying to print a numpy array without its units. I have done this succesfully if a quantity is a float (e. g. 3 *ureg.milliampere). On the other hand, in case of an array, I cannot have the array returned . Does anybody know how to to return the whole array without the units?

import pint
ureg=pint.UnitRegistry()
i=3*ureg.milliampere 
print (i.magnitude)
>>>3 # This is what I expect

x=np.random.rand(6)*ureg.milliampere`
print (x.magnitude)

>>>1 # I want to have the array returned, instead.
MarianD
  • 13,096
  • 12
  • 42
  • 54
kostas
  • 101
  • 12

0 Answers0