home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 240554085

This data as json

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/839#issuecomment-240554085 https://api.github.com/repos/pydata/xarray/issues/839 240554085 MDEyOklzc3VlQ29tbWVudDI0MDU1NDA4NQ== 1217238 2016-08-17T21:26:47Z 2016-08-17T21:26:47Z MEMBER

Indeed coords is a bad keyword argument name. On concat it indicates which coordinates from the concatenated objects should be concatenated. It probably should be renamed something like which_coords. It's not a way to set new coordinates.

So you can actually do this right now if you provide a DataArray or pandas.Index as the argument dim argument to concat.

Instead of:

DA_data = xr.concat(list(D_patient_DA.values()), dim="Patients") DA_data.coords["Patients"] = list(D_patient_DA.keys())

you could write:

DA_data = xr.concat(list(D_patient_DA.values()), dim=pandas.Index(D_patient_DA.keys(), name='Patients'))

But in this particular case (converting a dictionary to a DataArray), you can actually just use the Dataset.to_array() method instead, e.g., xr.Dataset(D_patient_DA).to_array(dim='Patients')

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  152061016
Powered by Datasette · Queries took 0.763ms · About: xarray-datasette