Skip to content

Datetime-like values errors #20

@grkhr

Description

@grkhr

Got some problems with datetime-like values.
Tried with pandas 1.0.3 and 0.25.3, both don't working.
fastavro 0.23.4.

date

Traceback (most recent call last):

  File "<ipython-input-180-724a28b4d15a>", line 1, in <module>
    pdx.to_avro('test.avro', df.drop(columns=['event_timestamp']))

  File "/opt/anaconda3/lib/python3.7/site-packages/pandavro/__init__.py", line 151, in to_avro
    records=df.to_dict('records'), codec=codec)

  File "fastavro/_write.pyx", line 628, in fastavro._write.writer

  File "fastavro/_write.pyx", line 581, in fastavro._write.Writer.write

  File "fastavro/_write.pyx", line 335, in fastavro._write.write_data

  File "fastavro/_write.pyx", line 285, in fastavro._write.write_record

  File "fastavro/_write.pyx", line 333, in fastavro._write.write_data

  File "fastavro/_write.pyx", line 249, in fastavro._write.write_union

ValueError: datetime.date(2020, 6, 10) (type <class 'datetime.date'>) do not match ['null', 'string']

NaTType

Traceback (most recent call last):

  File "<ipython-input-182-991911d54074>", line 1, in <module>
    pdx.to_avro('test.avro', df.drop(columns=['event_date','items']))

  File "/opt/anaconda3/lib/python3.7/site-packages/pandavro/__init__.py", line 151, in to_avro
    records=df.to_dict('records'), codec=codec)

  File "fastavro/_write.pyx", line 628, in fastavro._write.writer

  File "fastavro/_write.pyx", line 581, in fastavro._write.Writer.write

  File "fastavro/_write.pyx", line 335, in fastavro._write.write_data

  File "fastavro/_write.pyx", line 285, in fastavro._write.write_record

  File "fastavro/_write.pyx", line 333, in fastavro._write.write_data

  File "fastavro/_write.pyx", line 234, in fastavro._write.write_union

  File "fastavro/_validation.pyx", line 169, in fastavro._validation._validate

  File "fastavro/_validation.pyx", line 178, in fastavro._validation._validate

  File "fastavro/_logical_writers.pyx", line 72, in fastavro._logical_writers.prepare_timestamp_micros

  File "fastavro/_logical_writers.pyx", line 105, in fastavro._logical_writers.prepare_timestamp_micros

  File "pandas/_libs/tslibs/nattype.pyx", line 58, in pandas._libs.tslibs.nattype._make_error_func.f

ValueError: NaTType does not support timestamp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions