File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,9 @@ the level numbers:
162
162
163
163
.. _reshaping.stack_multiple :
164
164
165
+ Multiple Levels
166
+ ~~~~~~~~~~~~~~~
167
+
165
168
You may also stack or unstack more than one level at a time by passing a list
166
169
of levels, in which case the end result is as if each level in the list were
167
170
processed individually.
@@ -188,6 +191,9 @@ not a mixture of the two).
188
191
# from above is equivalent to:
189
192
df.stack(level = [1 , 2 ])
190
193
194
+ Missing Data
195
+ ~~~~~~~~~~~~
196
+
191
197
These functions are intelligent about handling missing data and do not expect
192
198
each subgroup within the hierarchical index to have the same set of labels.
193
199
They also can handle the index being unsorted (but you can make it sorted by
@@ -210,6 +216,9 @@ which level in the columns to stack:
210
216
df2.stack(' exp' )
211
217
df2.stack(' animal' )
212
218
219
+ With a MultiIndex
220
+ ~~~~~~~~~~~~~~~~~
221
+
213
222
Unstacking when the columns are a ``MultiIndex `` is also careful about doing
214
223
the right thing:
215
224
You can’t perform that action at this time.
0 commit comments