home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 124664101

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
124664101 MDU6SXNzdWUxMjQ2NjQxMDE= 699 BUG: Dataset.from_dataframe() losing dims? 953992 closed 0     4 2016-01-03T18:42:52Z 2016-01-04T02:05:33Z 2016-01-04T02:05:33Z MEMBER      

``` In [16]: df = DataFrame({'a': list('abc'), 'b': list(range(1, 4)), 'c': np.arange(3, 6).astype('u1'), 'd': np.arange(4.0, 7.0, dtype='float64'), 'e': [True, False, True], 'f': pd.Categorical(list('abc')), 'g': pd.date_range('20130101', periods=3), 'h': pd.date_range('20130101', periods=3, tz='US/Eastern')} )

In [17]: df.index.name = 'foo' In [18]: df.columns.name = 'bar'

In [19]: df Out[19]: bar a b c d e f g h foo
0 a 1 3 4 True a 2013-01-01 2013-01-01 00:00:00-05:00 1 b 2 4 5 False b 2013-01-02 2013-01-02 00:00:00-05:00 2 c 3 5 6 True c 2013-01-03 2013-01-03 00:00:00-05:00

In [20]: df.dtypes Out[20]: bar a object b int64 c uint8 d float64 e bool f category g datetime64[ns] h datetime64[ns, US/Eastern] dtype: object ```

``` In [21]: import xray

In [22]: xray.version Out[22]: '0.6.1'

In [23]: xray.Data xray.DataArray xray.Dataset
In [23]: xray.DataArray(df) Out[23]: <xray.DataArray (foo: 3, bar: 8)> array([['a', 1, 3, 4.0, True, 'a', Timestamp('2013-01-01 00:00:00'), Timestamp('2013-01-01 00:00:00-0500', tz='US/Eastern')], ['b', 2, 4, 5.0, False, 'b', Timestamp('2013-01-02 00:00:00'), Timestamp('2013-01-02 00:00:00-0500', tz='US/Eastern')], ['c', 3, 5, 6.0, True, 'c', Timestamp('2013-01-03 00:00:00'), Timestamp('2013-01-03 00:00:00-0500', tz='US/Eastern')]], dtype=object) Coordinates: * foo (foo) int64 0 1 2 * bar (bar) object 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h'

In [24]: xray.Dat
xray.DataArray xray.Dataset

In [24]: xray.Dataset.from_dataframe(df) Out[24]: <xray.Dataset> Dimensions: (foo: 3) Coordinates: * foo (foo) int64 0 1 2 Data variables: a (foo) object 'a' 'b' 'c' b (foo) int64 1 2 3 c (foo) uint8 3 4 5 d (foo) float64 4.0 5.0 6.0 e (foo) bool True False True f (foo) category 'a' 'b' 'c' g (foo) datetime64[ns] 2013-01-01 2013-01-02 2013-01-03 h (foo) datetime64[ns] 2013-01-01T05:00:00 2013-01-02T05:00:00 ... ```

so [23] is a bit unsatisfying as it basically gloms together things. But [24] doesn't appear correct as its now 3 dims? what happened to bar?

this in the context of .to_xray() (from pandas). coming shortly. see here

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/699/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
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 0.634ms · About: xarray-datasette