home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where user = 14136435 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue 3

  • pd.Grouper support? 1
  • add multiindex level name checking to .rename() 1
  • Error concatenating Multiindex variables 1

user 1

  • hazbottles · 3 ✖

author_association 1

  • CONTRIBUTOR 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
570068215 https://github.com/pydata/xarray/issues/3659#issuecomment-570068215 https://api.github.com/repos/pydata/xarray/issues/3659 MDEyOklzc3VlQ29tbWVudDU3MDA2ODIxNQ== hazbottles 14136435 2020-01-01T17:09:23Z 2020-01-05T10:58:18Z CONTRIBUTOR

The solution that makes sense to me is:

Multiindex level name conflicts should only be checked for coordinates, not data variables.

But I've only spent a few hours digging through the codebase to try and understand this problem - I'm not quite sure what the implications would be.

Here is another place where it feels like it makes more sense to only check the MultiIndex level names of coords:

```python

da = xr.DataArray([0, 1], dims=["location"], coords={"lat": ("location", [10, 11]), "lon": ("location", [20, 21])}).set_index(location=["lat", "lon"]) location = da["location"]

you cannot directly make a dataset with location as a data variable

xr.Dataset({"data": location}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/harry/code/xarray/xarray/core/dataset.py", line 541, in init variables, coord_names, dims, indexes = merge_data_and_coords( File "/home/harry/code/xarray/xarray/core/merge.py", line 466, in merge_data_and_coords return merge_core( File "/home/harry/code/xarray/xarray/core/merge.py", line 556, in merge_core assert_unique_multiindex_level_names(variables) File "/home/harry/code/xarray/xarray/core/variable.py", line 2363, in assert_unique_multiindex_level_names raise ValueError("conflicting MultiIndex level name(s):\n%s" % conflict_str) ValueError: conflicting MultiIndex level name(s): 'lat' (location), 'lat' (data) 'lon' (location), 'lon' (data)

but if you go a round-about way, you can exploit that assign_coords only checks

the multiindex names of coordinates, not data variables

```python

ds = xr.Dataset({"data": xr.DataArray(data=location.variable._data, dims=["location"])}) ds = ds.assign_coords({"location": location}) ds <xarray.Dataset> Dimensions: (location: 2) Coordinates: * location (location) MultiIndex - lat (location) int64 10 11 - lon (location) int64 20 21 Data variables: data (location) object (10, 20) (11, 21) ds["data"].variable._data PandasIndexAdapter(array=MultiIndex([(10, 20), (11, 21)], names=['lat', 'lon']), dtype=dtype('O')) ```

If making variable.assert_unique_multiindex_level_names only check coords is the way to go, I'm keen + happy to try putting together a pull request for this.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Error concatenating Multiindex variables 544375718
570539403 https://github.com/pydata/xarray/pull/3658#issuecomment-570539403 https://api.github.com/repos/pydata/xarray/issues/3658 MDEyOklzc3VlQ29tbWVudDU3MDUzOTQwMw== hazbottles 14136435 2020-01-03T10:53:05Z 2020-01-03T10:53:05Z CONTRIBUTOR

Thanks, @hazbottles, for your contribution.

This looks nice. Please add your contribution to what's new in /doc/whats-new.rst

Done.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  add multiindex level name checking to .rename() 544371732
341598412 https://github.com/pydata/xarray/issues/364#issuecomment-341598412 https://api.github.com/repos/pydata/xarray/issues/364 MDEyOklzc3VlQ29tbWVudDM0MTU5ODQxMg== hazbottles 14136435 2017-11-03T00:40:14Z 2017-11-03T00:40:39Z CONTRIBUTOR

Hi, being able to pass a pd.TimeGrouper to .groupby() would be really handy. Here is my use-case and work around at the moment (.resample() doesn't serve my needs because I need to iterate over the groups):

```python import pandas as pd import xarray as xr

dates = pd.DatetimeIndex(['2017-01-01 15:00', '2017-01-02 14:00', '2017-01-02 23:00']) da = xr.DataArray([1, 2, 3], dims=['time'], coords={'time': dates}) time_grouper = pd.TimeGrouper(freq='24h', base=15)

digging around the source code for xr.DataArray.resample i found this

grouped = xr.core.groupby.DataArrayGroupBy(da, 'time', grouper=time_grouper)

for _, sub_da in grouped: print(sub_da) ```

which prints: <xarray.DataArray (time: 2)> array([1, 2]) Coordinates: * time (time) datetime64[ns] 2017-01-01T15:00:00 2017-01-02T14:00:00 <xarray.DataArray (time: 1)> array([3]) Coordinates: * time (time) datetime64[ns] 2017-01-02T23:00:00

Would it be possible to add a grouper kwarg to .groupby(), e.g. python da.groupby('time', grouper=time_grouper)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  pd.Grouper support? 60303760

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 65.127ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows