Not able to 'numpy.float64' to int in python

Question:

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?

Asked By: Slartibartfast

||

Answers:

Can you try the following:

float(ax.get_ylim()[0])
Answered By: Jeril

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.

Answered By: Lorewalker Cho
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.