Skip to content

Commit eaabe81

Browse files
committed
DOC:Remove supression from ipython directive to make object visible
DOC: Some minor additional fixes Added some corrections
1 parent 8e0976c commit eaabe81

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/source/groupby.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,21 @@ GroupBy with MultiIndex
257257
With :ref:`hierarchically-indexed data <advanced.hierarchical>`, it's quite
258258
natural to group by one of the levels of the hierarchy.
259259

260+
Let's create a series with a two-level ``MultiIndex``.
261+
260262
.. ipython:: python
261-
:suppress:
262263
263264
264265
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
265266
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
266-
tuples = list(zip(*arrays))
267-
tuples
268-
index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second'])
267+
index = pd.MultiIndex.from_arrays(arrays, names=['first', 'second'])
269268
s = pd.Series(np.random.randn(8), index=index)
269+
s
270+
271+
We can then group by one of the levels in ``s``.
270272

271273
.. ipython:: python
272274
273-
s
274275
grouped = s.groupby(level=0)
275276
grouped.sum()
276277

0 commit comments

Comments
 (0)