home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 1596890616 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 3

  • headtr1ck 2
  • dcherian 1
  • akanshajais 1

author_association 3

  • COLLABORATOR 2
  • MEMBER 1
  • NONE 1

issue 1

  • plotting facet grid with singleton dimension should create a facet grid with size 1 · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1494018319 https://github.com/pydata/xarray/issues/7552#issuecomment-1494018319 https://api.github.com/repos/pydata/xarray/issues/7552 IC_kwDOAMm_X85ZDOkP akanshajais 85181086 2023-04-03T09:51:16Z 2023-04-08T11:37:40Z NONE

The reason why you are getting a KeyError in your first example when trying to plot with col='y' is because when y is a dimension with length 1, xarray automatically drops the dimension and promotes its coordinates to 1D.

In your example, the y dimension has length 1, so it is dropped, and da.coords['y'] returns a scalar value rather than a 1D coordinate array. When you try to plot with col='y', xarray looks for the 'y' key in the coordinates dictionary, which doesn't exist, hence the KeyError.

To work around this, you can manually promote the y coordinate to a 1D array using the expand_dims method:

``` import xarray as xr import numpy as np

da = xr.DataArray(np.random.rand(3,1), dims=('x', 'y')) da.coords['y'] = da.coords['y'].expand_dims('y') da.plot(col='y')

``` This will ensure that the y coordinate is always a 1D array, even when the dimension it represents has length 1.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  plotting facet grid with singleton dimension should create a facet grid with size 1 1596890616
1447568902 https://github.com/pydata/xarray/issues/7552#issuecomment-1447568902 https://api.github.com/repos/pydata/xarray/issues/7552 IC_kwDOAMm_X85WSCYG dcherian 2448579 2023-02-28T04:46:24Z 2023-02-28T04:46:24Z MEMBER

See #620 (!)

Maybe we should exclude col, row dims from the squeeze?

This seems sensible.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  plotting facet grid with singleton dimension should create a facet grid with size 1 1596890616
1447067702 https://github.com/pydata/xarray/issues/7552#issuecomment-1447067702 https://api.github.com/repos/pydata/xarray/issues/7552 IC_kwDOAMm_X85WQIA2 headtr1ck 43316012 2023-02-27T20:50:13Z 2023-02-27T20:50:13Z COLLABORATOR

@liorella-qm in the meantime you can use da.plot.line(col='y') as a workaround

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  plotting facet grid with singleton dimension should create a facet grid with size 1 1596890616
1447057892 https://github.com/pydata/xarray/issues/7552#issuecomment-1447057892 https://api.github.com/repos/pydata/xarray/issues/7552 IC_kwDOAMm_X85WQFnk headtr1ck 43316012 2023-02-27T20:43:00Z 2023-02-27T20:48:19Z COLLABORATOR

This is caused by the squeeze() here: https://github.com/pydata/xarray/blob/41949209b6cfb0d5c25d000b1e0c5739b513385c/xarray/plot/dataarray_plot.py#L267

@Illviljan do you know why this is required? I assume you want to remove singleton dimensions to better choose the correct plot method?

Maybe we should exclude col, row dims from the squeeze? something like: darray.squeeze(d for d, s in darray.sizes.items() if s == 1 and d not in (row, col, hue))

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  plotting facet grid with singleton dimension should create a facet grid with size 1 1596890616

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1601.925ms · About: xarray-datasette