Home > OS >  Not able to 'numpy.float64' to int in python
Not able to 'numpy.float64' to int in python

Time:08-22

I am trying to convert 'numpy.float64' to float to do this:

enter image description here

ax.get_ylim()[0].astype(float)

Which prints out -2.25

But when I check with type(ax.get_ylim()[0].astype(float)) it is printing out numpy.float64. Why is it not changing the data type?

CodePudding user response:

Can you try the following:

float(ax.get_ylim()[0])

CodePudding user response:

you can try this

(ax.get_ylim()[0]).astype(float)

this is going working maybe astype need obvious object

@Jeril 's way is really obvious but if you have to use astype() this could be help.

  • Related