You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using to_gbq() to load a local DataFrame into BigQuery. I'm running into an issue where floating point numbers are gaining significant figures and therefore causing numerical overflow errors when loaded to BigQuery.
The load.py module's encode_chunk() function writes to a local CSV buffer using Pandas' to_csv() function, which has a known issue regarding added significant figures on some operating systems (read more here).
In my case, 0.208 was transformed to 0.20800000000000002.
I've been able to solve the issue locally by changing the float_format parameter to '%g' in the encode_chunk() function's pd.to_csv()call:
In it, I made one change to the proposal above: increasing the number of significant figures to 15 (decimal), the max safely allowed under IEEE-754 double formatting.
I'm using
to_gbq()
to load a local DataFrame into BigQuery. I'm running into an issue where floating point numbers are gaining significant figures and therefore causing numerical overflow errors when loaded to BigQuery.The
load.py
module'sencode_chunk()
function writes to a local CSV buffer using Pandas'to_csv()
function, which has a known issue regarding added significant figures on some operating systems (read more here).In my case, 0.208 was transformed to 0.20800000000000002.
I've been able to solve the issue locally by changing the
float_format
parameter to'%g'
in theencode_chunk()
function'spd.to_csv()
call:Can this be safely applied as a default?
Versions:
OS details:
The text was updated successfully, but these errors were encountered: