home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where state = "closed" and user = 49461634 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 1

  • issue 1

state 1

  • closed · 1 ✖

repo 1

  • xarray 1
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
502060636 MDU6SXNzdWU1MDIwNjA2MzY= 3368 Shift DataArray along a coordinate for different values of each element of another coordinate gabrieltagleh 49461634 closed 0     1 2019-10-03T13:17:10Z 2020-03-29T14:18:11Z 2020-03-29T14:16:43Z NONE      

MCVE Code Sample

```python

Your code here

Original_DataArray = <xarray.DataArray 'Conexões Domésticas e Piscinas' (projetos_resi: 9, res_segmentacao: 21, time: 133, bands: 10)>

Shift_Map = <xarray.DataArray 'Anos por Desconto' (res_segmentacao: 21)> array([ 0, 0, 0, 24, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 36, 60, 36, 0])

"Multi" Shift Function

def _fn(dataArray,over_shift_index,multi_shift_index,shift_map,initialValues=None): """
-dataArray: dataarray to shift -over_shift_index: index over apply shit of dataarray -multi_shift_index: index with the elements to apply a different value shift -shift_map: datarray indexed by multi_shift_index with the values to shift for each element """

_da = dataArray.copy()
_shift_map = shift_map.astype(int)

for name, sl in _da.groupby(multi_shift_index.name):
    _shift = subscript(_shift_map, multi_shift_index, name ).values.tolist()
    _sl = sl.squeeze(multi_shift_index.name).shift(time = _shift)

    _dict = {multi_shift_index.name : name}
    _da.loc[_dict] = _sl


return _da.fillna(0.)

```

Expected Output

Same estructure DataArray shifted along the "time" coordinate by a different value for each element of the "res_segmentacao" coordinate.

python exp_output= multidynamic( Original_DataArray , time, res_segmentacao, Shift_Map )

Problem Description

I´ve reached my objective but I wanted to consult if anyone had donde this in a more efficient way. Thanks!

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3368/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

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

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 321.277ms · About: xarray-datasette