import xarray as xr
default_values = [0, 1]
gender_values = [0, 1]
occupation_values = [0, 1]
activity_values = [0, 1]
# without using fake-data-for-learning method
counts = [
[
[
[1911., 919.],
[ 80., 18.]
],
[
[ 654., 2820.],
[ 35., 64.]
]
],
[
[
[ 0., 0.],
[1641., 288.]],
[
[ 0., 0.],
[ 618., 952.]
]
]
]
contingency = xr.DataArray(
counts,
dims=('default', 'gender', 'activity', 'occupation'),
coords=dict(
default=default_values,
gender=gender_values,
activity=activity_values,
occupation=occupation_values
)
)