Skip to content

Commit 99cd849

Browse files
blosetswast
authored andcommitted
Explicitly use 64bit integers (#121)
On 64-bit windows 10 the `int` values are cast into 32-bit integers for reasons given here https://stackoverflow.com/questions/36278590/numpy-array-dtype-is-coming-as-int32-by-default-in-a-windows-10-64-bit-machine This leads to unhanded exceptions when handling values beyond 32-bit signed range In Bigquery, int is always 64bit, so the solution is to specify the data type explicitly
1 parent b1e1ac6 commit 99cd849

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas_gbq/gbq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
848848

849849
# cast BOOLEAN and INTEGER columns from object to bool/int
850850
# if they dont have any nulls AND field mode is not repeated (i.e., array)
851-
type_map = {'BOOLEAN': bool, 'INTEGER': int}
851+
type_map = {'BOOLEAN': bool, 'INTEGER': np.int64}
852852
for field in schema['fields']:
853853
if field['type'].upper() in type_map and \
854854
final_df[field['name']].notnull().all() and \

0 commit comments

Comments
 (0)