@@ -68,6 +68,33 @@ class MultiIndex(Index):
68
68
Copy the meta-data
69
69
verify_integrity : boolean, default True
70
70
Check that the levels/labels are consistent and valid
71
+
72
+ Examples
73
+ ---------
74
+ A new ``MultiIndex`` is typically constructed using one of the helper
75
+ methods :meth:`MultiIndex.from_arrays``, :meth:`MultiIndex.from_product``
76
+ and :meth:`MultiIndex.from_tuples``. For example (using ``.from_arrays``):
77
+
78
+ >>> arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']]
79
+ >>> MultiIndex.from_arrays(arrays, names=('number', 'color'))
80
+ MultiIndex(levels=[[1, 2], ['blue', 'red']],
81
+ labels=[[0, 0, 1, 1], [1, 0, 1, 0]],
82
+ names=['number', 'color'])
83
+
84
+ See further examples for how to construct a MultiIndex in the doc strings
85
+ of the mentioned helper methods.
86
+
87
+ Notes
88
+ -----
89
+ See the `user guide
90
+ <http://pandas.pydata.org/pandas-docs/stable/advanced.html>`_ for more.
91
+
92
+ See Also
93
+ --------
94
+ MultiIndex.from_arrays : Convert list of arrays to MultiIndex
95
+ MultiIndex.from_product : Create a MultiIndex from the cartesian product
96
+ of iterables
97
+ MultiIndex.from_tuples : Convert list of tuples to a MultiIndex
71
98
"""
72
99
73
100
# initialize to zero-length tuples to make everything work
0 commit comments