@@ -1658,6 +1658,12 @@ def get_level_values(self, level):
16581658 Values is a level of this MultiIndex converted to
16591659 a single :class:`Index` (or subclass thereof).
16601660
1661+ Notes
1662+ -----
1663+ If the level contains missing values, the result may be casted to
1664+ ``float`` with missing values specified as ``NaN``. This is because
1665+ the level is converted to a regular ``Index``.
1666+
16611667 Examples
16621668 --------
16631669 Create a MultiIndex:
@@ -1671,6 +1677,16 @@ def get_level_values(self, level):
16711677 Index(['a', 'b', 'c'], dtype='object', name='level_1')
16721678 >>> mi.get_level_values('level_2')
16731679 Index(['d', 'e', 'f'], dtype='object', name='level_2')
1680+
1681+ If a level contains missing values, the return type of the level
1682+ maybe casted to ``float``.
1683+
1684+ >>> pd.MultiIndex.from_arrays([[1, None, 2], [3, 4, 5]]).dtypes
1685+ level_0 int64
1686+ level_1 int64
1687+ dtype: object
1688+ >>> pd.MultiIndex.from_arrays([[1, None, 2], [3, 4, 5]]).get_level_values(0)
1689+ Float64Index([1.0, nan, 2.0], dtype='float64')
16741690 """
16751691 level = self ._get_level_number (level )
16761692 values = self ._get_level_values (level )
0 commit comments