-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feature request: Assign coords for new axis in xr.concat #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think the Would it possible to make this thread a feature request ? |
Indeed So you can actually do this right now if you provide a Instead of:
you could write:
But in this particular case (converting a dictionary to a DataArray), you can actually just use the |
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity |
Uh oh!
There was an error while loading. Please reload this page.
It would be awesome to add coords while concatenating. Basically, combining this into one line:
DA_data = xr.concat(list(D_patient_DA.values()), dim="Patients"); DA_data.coords["Patients"] = list(D_patient_DA.keys())
For this dataset I made up, imagine 100 patients, 12 months, and 10000 attributes which would be a typical 3D dataset. Basically, I end up with a bunch of 2D DataArrays (row=months, col=attributes) this DataArray is the value in my dictionary and the patient it came from is the key (i.e. (patient_x : DataArray_X) )
I'm trying to do
DA_data = xr.concat(list(D_patient_DA.values()), coords = list(D_patient_DA.keys()), dim="Patients")
but it's not working and I need to split it up likeDA_data = xr.concat(list(D_patient_DA.values()), dim="Patients"); DA_data.coords["Patients"] = list(D_patient_DA.keys())
Am I not writing the one-liner in the right format?
The docs say
coords : {‘minimal’, ‘different’, ‘all’ o list of str}
so it seems like it should workHere is my code for generating fake data for this problem:
The text was updated successfully, but these errors were encountered: