home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 124441012

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
124441012 MDU6SXNzdWUxMjQ0NDEwMTI= 692 Transpose modifies dtype of index, when a PeriodIndex 5635139 closed 0     7 2015-12-31T07:11:56Z 2016-01-03T18:41:04Z 2016-01-02T01:48:48Z MEMBER      

This is very peculiar & specific, but also fairly impactful for us.

If you - Create a Dataset with a coord that is a PeriodIndex - Transpose that coord - Add a variable to the Dataset that needs to be reindexed

...then the type of the index changes from object to int64. This then causes other arrays added to that dataset to show up as NaNs throughout.

Here's an example. Note the dtype('O')) at the end of each output.

``` python In [61]: series = pd.Series(np.random.rand(10),index=pd.period_range(start='2000', periods=10,name='date')) ​ ds = xray.Dataset({'number 1':series}) ds['number 2'] = ds['number 1'] ds, ds.date.dtype Out[61]: (<xray.Dataset> Dimensions: (date: 10) Coordinates: * date (date) object 10957 10958 10959 10960 10961 10962 10963 10964 ... Data variables: number 1 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 2 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ..., dtype('O')) In [62]:

ds, ds.date.dtype ds=ds.transpose('date') ds, ds.date.dtype Out[62]: (<xray.Dataset> Dimensions: (date: 10) Coordinates: * date (date) object 10957 10958 10959 10960 10961 10962 10963 10964 ... Data variables: number 1 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 2 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ..., dtype('O')) In [63]:

ds ds['number 3'] = ds['number 1'] ds, ds.date.dtype Out[63]: (<xray.Dataset> Dimensions: (date: 10) Coordinates: * date (date) object 10957 10958 10959 10960 10961 10962 10963 10964 ... Data variables: number 1 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 2 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 3 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ..., dtype('O')) In [64]:

ds ds['number 4'] = ds['number 1'][:5] ds, ds.date.dtype Out[64]: (<xray.Dataset> Dimensions: (date: 10) Coordinates: * date (date) int64 10957 10958 10959 10960 10961 10962 10963 10964 ... Data variables: number 1 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 2 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 3 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 0.6723 ... number 4 (date) float64 0.1133 0.5952 0.5467 0.2035 0.2022 nan nan nan ..., dtype('int64')) ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/692/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

  • 0 rows from issues_id in issues_labels
  • 7 rows from issue in issue_comments
Powered by Datasette · Queries took 78.187ms · About: xarray-datasette