home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 113407784

This data as json

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
113407784 MDU6SXNzdWUxMTM0MDc3ODQ= 639 Incorrect dimension names when using sel_points 15328599 closed 0     3 2015-10-26T17:28:56Z 2019-01-30T13:04:42Z 2019-01-30T13:04:42Z NONE      

When calling an xray.DataArray with sel_points, if a named pandas series or index object is passed into the dim argument the resulting DataArray does not make use of the name metadata.

``` arr = xray.DataArray(np.random.rand(4, 3), [('time', pd.date_range('2000-01-01', periods=4)), ('space', ['IA', 'IL', 'IN'])]) times = pd.to_datetime(['2000-01-03', '2000-01-02', '2000-01-01']) test_df = pd.DataFrame.from_dict({'Test_Series': np.random.rand(3)})

test_series = test_df['Test_Series'] test_series 0 0.573754 1 0.958703 2 0.734037 Name: Test_Series, dtype: float64

test_index = pd.Index(test_series, name='foo') test_index Float64Index([0.573754086648, 0.958702839214, 0.734036515556], dtype='float64', name=u'foo')

arr.sel_points(space=['IA', 'IL', 'IN'], time=times, dim=test_series) <xray.DataArray (points: 3)> array([ 0.33860832, 0.94424278, 0.05244533]) Coordinates: time (points) datetime64[ns] 2000-01-03 2000-01-02 2000-01-01 space (points) |S2 'IA' 'IL' 'IN' * points (points) float64 0.5738 0.9587 0.734

arr.sel_points(space=['IA', 'IL', 'IN'], time=times, dim=test_index) <xray.DataArray (points: 3)> array([ 0.33860832, 0.94424278, 0.05244533]) Coordinates: time (points) datetime64[ns] 2000-01-03 2000-01-02 2000-01-01 space (points) |S2 'IA' 'IL' 'IN' * points (points) float64 0.5738 0.9587 0.734 ```

In both the index and series cases the correct information from each Pandas object is used for the dimension values, however the name's of the fields remain defaulted to "points".

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

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.673ms · About: xarray-datasette