In_d_a
In_d_a

Reputation: 21

Pd.read_sql add zero to int number from table sql server

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.

Upvotes: 0

Views: 255

Answers (1)

cdrrr
cdrrr

Reputation: 1112

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

Upvotes: 0

Related Questions