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
Attempt to save the dataframe to an '.avro' file using the following command:
import pandavro as pdx
path = 'output.avro'
pdx.to_avro(path, df, schema=None)
Expected behavior:
The dataframe should be saved to an '.avro' file without any errors.
Actual behavior:
The following error is raised:
File "fastavro/_write.pyx", line 779, in fastavro._write.writer
File "fastavro/_write.pyx", line 687, in fastavro._write.Writer.__init__
File "fastavro/_schema.pyx", line 173, in fastavro._schema.parse_schema
File "fastavro/_schema.pyx", line 407, in fastavro._schema._parse_schema
File "fastavro/_schema.pyx", line 475, in fastavro._schema.parse_field
File "fastavro/_schema.pyx", line 233, in fastavro._schema._parse_schema
File "fastavro/_schema.pyx", line 263, in fastavro._schema._parse_schema
TypeError: argument of type 'NoneType' is not iterable
The issue occurs because the "id" column is inferred as ['null', None] instead of ['null', 'int'] when its data type is set to object.
When the "id" column has the data type integer, the process of saving the '.avro' file is successful.
Workaround:
As a temporary workaround, the data type of the "id" column should be explicitly set to integer before saving the dataframe to an '.avro' file:
Prerequisites:
Steps to reproduce the issue:
Expected behavior:
The dataframe should be saved to an '.avro' file without any errors.
Actual behavior:
The following error is raised:
The inferred schema is:
Additional Information:
The issue occurs because the "id" column is inferred as ['null', None] instead of ['null', 'int'] when its data type is set to object.
When the "id" column has the data type integer, the process of saving the '.avro' file is successful.
Workaround:
As a temporary workaround, the data type of the "id" column should be explicitly set to integer before saving the dataframe to an '.avro' file:
The text was updated successfully, but these errors were encountered: