In python3, I mainly use float or np.float32/64 and when it comes to store it into a database, even if SQL type is Numeric/Decimal we end up with 0.400000000000021 or something like that instead of 0.4
It may be a problem if such data is accessed from another application.
Working only with decimal.Decimal in python isn't an answer for us, since we heavely make use of pandas, and Decimal is not supported.
A solution would be to cast float to Decimal just before inserting into SQL (SQL Server in our case but it's a detail). And then back from Decimal to float after SELECT.
Do you have another (and nicer) way to handle such issue ?
If you don't wan't/need the precision, you can use np.round(array,roundto)
how to store python float in SQL database