Adds a tryexcept block to check for the exception ValueError: invalid literal for int() with base 10: when type casting the set indices upon reading in data. This error is raised when trying to cast a column from a float to an int. If the error is raised, the entire column is first cast as a float, then in turn cast as an int. This seems to be the normal way to deal with this error according to stack overflow.
Tests for the ReadStrategy._check_index_dtypes(..) have been expanded to check for more datatypes as well. Previously they only tested for string->X type casting. (My bad for that 😅)
I would not exactly call this an elegant solution, since each column needs to be cast one by one if the except logic is entered. But this is a bit of an edge case, so I think it is probably okay for the time being.
Description
Adds a
try
except
block to check for the exceptionValueError: invalid literal for int() with base 10:
when type casting the set indices upon reading in data. This error is raised when trying to cast a column from afloat
to anint
. If the error is raised, the entire column is first cast as a float, then in turn cast as an int. This seems to be the normal way to deal with this error according to stack overflow.Tests for the
ReadStrategy._check_index_dtypes(..)
have been expanded to check for more datatypes as well. Previously they only tested for string->X type casting. (My bad for that 😅)I would not exactly call this an elegant solution, since each column needs to be cast one by one if the
except
logic is entered. But this is a bit of an edge case, so I think it is probably okay for the time being.Issue Ticket Number
Closes #167
Documentation
na