0

I'm wondering why pandas.read_sql add .zero at the end of my data please ? In SQL Server, the data are number indicated like int.

enter image description here

Someone knows why please?

And when I look type of data, it's indicated like float64.

1 Answer 1

0

According to this solution, this happens because your data might contains NaN values, so in order to handle this, int data type is automatically converted to float.

When introducing NAs into an existing Series or DataFrame via reindex or some other means, boolean and integer types will be promoted to a different dtype in order to store the NAs. These are summarized by this table:

Typeclass   Promotion dtype for storing NAs
floating    no change
object      no change
integer     cast to float64
boolean     cast to object
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.