-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I am trying to work with numpy.datetime64[ns], but the following:
import numpy
from inference_schema.parameter_types.numpy_parameter_type import NumpyParameterType
from inference_schema.schema_decorators import input_schema
data = numpy.array(["2023-06-06"],'datetime64[ns]')
schema = NumpyParameterType(data)
@input_schema("foo",schema)
def foo():
passThrows:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/testenv/lib/python3.10/site-packages/inference_schema/schema_decorators.py", line 41, in input_schema
swagger_schema = {param_name: param_type.input_to_swagger()}
File "/tmp/testenv/lib/python3.10/site-packages/inference_schema/parameter_types/numpy_parameter_type.py", line 99, in input_to_swagger
swagger_schema['example'] = self._get_swagger_sample(self.sample_input, items_count, swagger_schema['items'])
File "/tmp/testenv/lib/python3.10/site-packages/inference_schema/parameter_types/abstract_parameter_type.py", line 88, in _get_swagger_sample
item_sample = cls._get_data_record_swagger_sample(
File "/tmp/testenv/lib/python3.10/site-packages/inference_schema/parameter_types/abstract_parameter_type.py", line 127, in _get_data_record_swagger_sample
sample_swag = cls._timestamp_item_to_string(data_item)
File "/tmp/testenv/lib/python3.10/site-packages/inference_schema/parameter_types/abstract_parameter_type.py", line 76, in _timestamp_item_to_string
return cls._datetime_item_to_string(date_item)
File "/tmp/testenv/lib/python3.10/site-packages/inference_schema/parameter_types/abstract_parameter_type.py", line 82, in _datetime_item_to_string
return date_item.astype(dt.datetime).strftime("%Y-%m-%d %H:%M:%S,%f")
AttributeError: 'int' object has no attribute 'strftime'
Interestingly datetime64[us] does appear to work fine, but datetime64[ns] does not.
Metadata
Metadata
Assignees
Labels
No labels