I am trying to create a pandas DataFrame
with the hypothesis
library for code testing purporses with the following code:
from hypothesis.extra.pandas import columns, data_frames
from hypothesis.extra.numpy import datetime64_dtypes
@given(data_frames(index=datetime64_dtypes(max_period='Y', min_period='s'),
columns=columns("A B C".split(), dtype=int)))
The error I receive is the following:
E TypeError: 'numpy.dtype' object is not iterable
I suspect that this is because when I construct the DataFrame
for index=
I only pass a datetime
element and not a ps.Series
all with type datetime
for example. Even if this is the case (I am not sure), still I am not sure how to work with the hypothesis
library in order to achieve my goal.
Can anyone tell me what's wrong with the code and what the solution would be?