After reading excel file using pandas, i am validating the "Numberss" column is having only the Integer values. If any other value is present i am displaying error message.
When i loop through the column items the values are converted to float automatically
for index, item in self.df["Numberss"].items():
print(item)
If my input column is
5, 5.65, 5.55, 6
print(item) output is as:
5.0, 5.65, 5.55, 6.0
instead of
5, 5.65, 5.55, 6
It is because your column contains integer and null values. Pandas reads these null values as NaN which is internally stored as a float.
You will have to replace these NaN values with a integer value, if you want to the column type as int
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With