Skip to content

BUG: Wrong JSON sent to BigQuery when both integer and float fields in schema #116

Closed
@peshitz

Description

@peshitz

When both a float and integer field exist, integer fields (int64) are serialized as floats, resulting in an error from BigQuery (because in schema the field is defined as Integer).

df = pd.DataFrame([[1,1.1],[2,2.2] ],
                   index=['row 1', 'row 2'],
                   columns=['intColumn','floatColumn'])
 
# correct output
df.to_json()

# incorrect output (method used by pandas-gbq)
row = df.iloc[0]
row.to_json()

# correct output
df[['intColumn']].iloc[0].to_json()

Metadata

Metadata

Assignees

Labels

type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions