holoviz / holoviz/hvplot

Groupby fails for dimension called index

Open
#310 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

When trying to plot with one of the dimensions grouped, I sometimes get an error depending on the dimension I'm trying to group. I noticed that this happens _only_ because occasionally I name my dimension "index". I'm not sure if this is a _bug_ per se, but it's definitely something that could be changed.

For example, this works:
```
line2 = xr.DataArray(np.random.randn(7,3,99), dims=["z", "ind", "x"],
coords=dict(z=range(7), ind=range(3), x=range(99)))
line2.isel(z=3).hvplot.line(x="x", groupby=["ind"])
```

But this doesn't

```
line2 = xr.DataArray(np.random.randn(7,3,99), dims=["z", "index", "x"],
coords=dict(z=range(7), index=range(3), x=range(99)))
line2.isel(z=3).hvplot.line(x="x", groupby=["index"])
```

The latter one fails with: `KeyError: 'Level index must be same as name (None)'`.

Maybe I'm missing something, but I think the name of a variable shouldn't impact these kinds of things.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.