html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/3984#issuecomment-619635716,https://api.github.com/repos/pydata/xarray/issues/3984,619635716,MDEyOklzc3VlQ29tbWVudDYxOTYzNTcxNg==,1559890,2020-04-26T22:38:20Z,2020-04-26T22:38:20Z,NONE,Your both methods worked! Thank you!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,602793814
https://github.com/pydata/xarray/issues/3984#issuecomment-616503710,https://api.github.com/repos/pydata/xarray/issues/3984,616503710,MDEyOklzc3VlQ29tbWVudDYxNjUwMzcxMA==,35968931,2020-04-20T11:54:07Z,2020-04-20T11:54:07Z,MEMBER,"@keewis your answer (and a clarification that we can't do real ""ragged"" arrays) would make a useful cookbook or StackOverflow answer, since I suspect a lot of people have this question.","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,602793814
https://github.com/pydata/xarray/issues/3984#issuecomment-616211072,https://api.github.com/repos/pydata/xarray/issues/3984,616211072,MDEyOklzc3VlQ29tbWVudDYxNjIxMTA3Mg==,14808389,2020-04-19T19:24:51Z,2020-04-20T10:35:44Z,MEMBER,"this ultimately depends on how the last dimension of `A` and `B` are related (or rather, how you want to model the relationship). If they are not related at all, simply use different dimension names:
```python
In [2]: da1 = xr.DataArray(np.empty(shape=(2, 5, 100)), dims=(""x"", ""y"", ""z1""))
...: da2 = xr.DataArray(np.empty(shape=(2, 5, 101)), dims=(""x"", ""y"", ""z2""))
...: ds = xr.Dataset({""a"": da1, ""b"": da2})
...: ds
Out[2]:
Dimensions: (x: 2, y: 5, z1: 100, z2: 101)
Dimensions without coordinates: x, y, z1, z2
Data variables:
a (x, y, z1) float64 6.901e-310 6.901e-310 4.67e-310 ... 0.0 0.0 0.0
b (x, y, z2) float64 6.901e-310 6.901e-310 4.67e-310 ... 0.0 0.0 0.0
```
If they are related, assign coordinates to the dimensions:
```python
In [3]: da1 = xr.DataArray(
...: np.empty(shape=(2, 5, 100)),
...: dims=(""x"", ""y"", ""z""),
...: coords={""z"": np.arange(100)},
...: )
...: da2 = xr.DataArray(
...: np.empty(shape=(2, 5, 101)),
...: dims=(""x"", ""y"", ""z""),
...: coords={""z"": np.arange(101)},
...: )
...: ds = xr.Dataset({""a"": da1, ""b"": da2})
...: ds
Out[3]:
Dimensions: (x: 2, y: 5, z: 101)
Coordinates:
* z (z) int64 0 1 2 3 4 5 6 7 8 9 10 ... 91 92 93 94 95 96 97 98 99 100
Dimensions without coordinates: x, y
Data variables:
a (x, y, z) float64 6.901e-310 6.901e-310 ... 6.917e-323 nan
b (x, y, z) float64 6.901e-310 6.901e-310 ... 6.901e-310 -6.35e+53
```
In this case, `A` does not have the label `z=100`, so it is treated as missing (you should be familiar with the concept of ""missing values"" since you know `pandas`).","{""total_count"": 4, ""+1"": 4, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,602793814
https://github.com/pydata/xarray/issues/3984#issuecomment-616214519,https://api.github.com/repos/pydata/xarray/issues/3984,616214519,MDEyOklzc3VlQ29tbWVudDYxNjIxNDUxOQ==,34353851,2020-04-19T19:49:19Z,2020-04-19T19:49:19Z,NONE,"I dont try it, but i know your problem.
If you try to create from dataarray df.to_dataset(name='participant_A')
df.to_dataset(name='participant_B')
and after merge them?
xr.merge([ds1, ds2], compat='no_conflicts')
http://xarray.pydata.org/en/stable/combining.html
In potter case you could create nan values to create the same dimensions.
But i have never tried. I found another solution for my data, but it was my
alternative.
El dom., 19 abr. 2020 20:57, (Ray) Jinbiao Yang
escribió:
> I always use Pandas to deal with my neuroscience data (multi-dimension).
> It is annoying to stack and unstack all the time and I heard Xarray is
> designed for multi-dimension data.
>
> In neuroscience research, we usually have multiple participants and we
> will test them different times, which means the data may look like this:
>
> - participant A:
> - 2*5*100 matrix
> - participant B:
> - 2*5*101 matrix
>
> (100 and 101 are the testing times)
>
> But *Dataset doesn't support to have 2*5*100 DataArray and 2*5*101
> DataArray together*. Is there any solution to deal with that kind of data
> in Xarray?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> , or unsubscribe
>
> .
>
","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,602793814