@@ -61,26 +61,58 @@ Breaking changes
61
61
62
62
.. _this stackoverflow report : http://stackoverflow.com/questions/33158558/python-xray-extract-first-and-last-time-value-within-each-month-of-a-timeseries
63
63
64
- Bug fixes
65
- ~~~~~~~~~
64
+ Enhancements
65
+ ~~~~~~~~~~~~
66
66
67
- - Fixes for several issues found on ``DataArray `` objects with the same name
68
- as one of their coordinates (see :ref: `v0.7.0.breaking ` for more details).
69
- - Attempting to assign a ``Dataset `` or ``DataArray `` variable/attribute using
70
- attribute-style syntax (e.g., ``ds.foo = 42 ``) now raises an error rather
71
- than silently failing (:issue: `656 `, :issue: `714 `).
67
+ - Basic support for :py:class: `~pandas.MultiIndex ` coordinates on xray objects, including
68
+ indexing, :py:meth: `~DataArray.stack ` and :py:meth: `~DataArray.unstack `:
72
69
73
- - ``DataArray.to_masked_array `` always returns masked array with mask being an array
74
- (not a scalar value) (:issue: `684 `)
75
- - You can now pass pandas objects with non-numpy dtypes (e.g., ``categorical ``
76
- or ``datetime64 `` with a timezone) into xray without an error
77
- (:issue: `716 `).
70
+ .. ipython ::
71
+ :verbatim:
78
72
79
- v0.6.2 (unreleased)
80
- -------------------
73
+ In [7]: df = pd.DataFrame({'foo': range(3),
74
+ ...: 'x': ['a', 'b', 'b'],
75
+ ...: 'y': [0, 0, 1]})
81
76
82
- Enhancements
83
- ~~~~~~~~~~~~
77
+ In [8]: s = df.set_index(['x', 'y'])['foo']
78
+
79
+ In [12]: arr = xray.DataArray(s, dims='z')
80
+
81
+ In [13]: arr
82
+ Out[13]:
83
+ <xray.DataArray 'foo' (z: 3)>
84
+ array([0, 1, 2])
85
+ Coordinates:
86
+ * z (z) object ('a', 0) ('b', 0) ('b', 1)
87
+
88
+ In [19]: arr.indexes['z']
89
+ Out[19]:
90
+ MultiIndex(levels=[[u'a', u'b'], [0, 1]],
91
+ labels=[[0, 1, 1], [0, 0, 1]],
92
+ names=[u'x', u'y'])
93
+
94
+ In [14]: arr.unstack('z')
95
+ Out[14]:
96
+ <xray.DataArray 'foo' (x: 2, y: 2)>
97
+ array([[ 0., nan],
98
+ [ 1., 2.]])
99
+ Coordinates:
100
+ * x (x) object 'a' 'b'
101
+ * y (y) int64 0 1
102
+
103
+ In [26]: arr.unstack('z').stack(z=('x', 'y'))
104
+ Out[26]:
105
+ <xray.DataArray 'foo' (z: 4)>
106
+ array([ 0., nan, 1., 2.])
107
+ Coordinates:
108
+ * z (z) object ('a', 0) ('a', 1) ('b', 0) ('b', 1)
109
+
110
+ .. warning ::
111
+
112
+ xray's MultiIndex support is still experimental, and we have a long to-
113
+ do list of desired additions (:issue: `719 `). For example, you cannot yet
114
+ save a MultiIndex to a netCDF file. User contributions in this area
115
+ would be greatly appreciate :).
84
116
85
117
- Support for reading GRIB, HDF4 and other file formats via PyNIO _. See
86
118
:ref: `io.pynio ` for more details.
@@ -120,8 +152,27 @@ Enhancements
120
152
Bug fixes
121
153
~~~~~~~~~
122
154
155
+ - Fixes for several issues found on ``DataArray `` objects with the same name
156
+ as one of their coordinates (see :ref: `v0.7.0.breaking ` for more details).
157
+
158
+ - ``DataArray.to_masked_array `` always returns masked array with mask being an array
159
+ (not a scalar value) (:issue: `684 `)
160
+
123
161
- Allows for (imperfect) repr of Coords when underlying index is PeriodIndex (:issue: `645 `).
124
162
163
+ - Fixes for several issues found on ``DataArray `` objects with the same name
164
+ as one of their coordinates (see :ref: `v0.7.0.breaking ` for more details).
165
+ - Attempting to assign a ``Dataset `` or ``DataArray `` variable/attribute using
166
+ attribute-style syntax (e.g., ``ds.foo = 42 ``) now raises an error rather
167
+ than silently failing (:issue: `656 `, :issue: `714 `).
168
+
169
+ - ``DataArray.to_masked_array `` always returns masked array with mask being an array
170
+ (not a scalar value) (:issue: `684 `)
171
+
172
+ - You can now pass pandas objects with non-numpy dtypes (e.g., ``categorical ``
173
+ or ``datetime64 `` with a timezone) into xray without an error
174
+ (:issue: `716 `).
175
+
125
176
v0.6.1 (21 October 2015)
126
177
------------------------
127
178
0 commit comments