-
Notifications
You must be signed in to change notification settings - Fork 617
Closed
Description
I use hypothesis.extra.pandas
for creation of pandas.DataFrame. e.g. https://hypothesis.readthedocs.io/en/latest/numpy.html#hypothesis.extra.pandas.data_frames
from hypothesis.extra.pandas import column, data_frames
df = data_frames([column("A", dtype=int), column("B", dtype=float)]).example()
I would be great to have something similar for xarray. I'm not sure what the API would look like but here is a mock up
from hypothesis.extra.xarray import data_array, data_set
ds = data_set(
[
data_array("A", shape=(2, 2), dtype=int),
data_array("B", shape=(2, 2), dtype=float),
]
).example()
which could wrap the numpy functions
import xarray as xr
from hypothesis.extra.numpy import arrays
xr.Dataset(
{
"A": xr.DataArray(arrays(dtype=int, shape=(2, 2)).example()),
"B": xr.DataArray(arrays(dtype=float, shape=(2, 2)).example()),
}
)
Metadata
Metadata
Assignees
Labels
No labels