Last answered:

08 Jan 2022

Posted on:

03 Jan 2022


Resolved: Why are the values in the column 'Reason_2' float and not integer?

All the '0s' in the 'reason_2' column are in the form of float- i.e. 0.0 and not simply integers- i.e. 0 like the rest of the 'reason; columns. Why is that?

1 answers ( 1 marked as helpful)
Posted on:

08 Jan 2022


Hi Naiya!

Thanks for reaching out.

There are various reasons for having integer or floats values in your imported data set.
Sometimes, it may be due to the fact that the data has been inserted differently in its raw format (e.g. in Excel or as a *.csv), it could be obtained from different sources, or Python may automatically convert certain types of data into floats, instead of integers.
The latter is particularly possible when there are other floats in the column, since Python will always try to preserve data consistency by keeping all values in a certain column to be of the same type.

In any case, this is a situation that often happens in real life. In our case whether we are working with integers or floats in this column, won't really affect our computations (as you will see later in the course), that's why we felt free to leave this data type for this column.

Hope this helps.

Submit an answer