issue_comments: 970851123
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/4562#issuecomment-970851123 | https://api.github.com/repos/pydata/xarray/issues/4562 | 970851123 | IC_kwDOAMm_X8453gMz | 20617032 | 2021-11-16T23:39:09Z | 2021-11-16T23:39:09Z | NONE | I tested the method of adding a new level with ``` import numpy as np import pandas as pd import xarray as xr data = np.random.rand(50,5) x_idx = np.linspace(0, 50) mi_idx1 = ['a','b','c','d','e'] mi_idx2 = [1,2,3,4,5] mi = pd.MultiIndex.from_arrays([mi_idx1,mi_idx2], names=['mi_idx1', 'mi_idx2']) coords = { 'x': x_idx, 'mi': mi } da = xr.DataArray(data, coords=coords, dims = ['x', 'mi']) da = da.assign_coords(mi_plot = ('mi', da.indexes['mi'].values)) # add a level for plot display da.plot(hue='mi_plot', x='x') ``` It seems like this potentially happen behind the scenes, but I'm not sure. |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
735523592 |