Repository: pandas-dev/pandas

Issue:
BUG: Series/DataFrame with IntervalIndex doesn't display NaN in index 
#### Code Sample, a copy-pastable example if possible
The index in `Out[3]` is does not display `NaN`:
```python
In [1]: import numpy as np; import pandas as pd; pd.__version__
Out[1]: '0.25.0.dev0+359.gcaad3b5e5'

In [2]: ii = pd.IntervalIndex.from_tuples([(0, 1), np.nan, (2, 3)])

In [3]: pd.Series(list('abc'), index=ii)
Out[3]: 
(0.0, 1.0]    a
              b
(2.0, 3.0]    c
dtype: object
```
Note that this isn't an issue when the `Series` has `Interval` values, or when printing the index itself:
```python
In [4]: pd.Series(ii)
Out[4]: 
0    (0.0, 1.0]
1           NaN
2    (2.0, 3.0]
dtype: interval

In [5]: ii
Out[5]: 
IntervalIndex([(0.0, 1.0], nan, (2.0, 3.0]],
              closed='right',
              dtype='interval[float64]')
```
This does not appear to be an issue with other types of index and was working in 0.23.4.

#### Problem description
The output index in `Out[3]` is missing `NaN` for the second entry and is instead blank.

#### Expected Output
I'd expect `NaN` to be displayed in the index.

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit: caad3b5e566d74d5cf0a018378d71625c30bf145
python: 3.7.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.19.14-041914-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.25.0.dev0+359.gcaad3b5e5
pytest: 4.3.1
pip: 19.0.3
setuptools: 40.8.0
Cython: 0.29.6
numpy: 1.16.2
scipy: 1.2.1
pyarrow: 0.11.1
xarray: 0.11.3
IPython: 7.3.0
sphinx: 1.8.5
patsy: 0.5.1
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: 1.2.1
tables: 3.5.1
numexpr: 2.6.9
feather: None
matplotlib: 3.0.3
openpyxl: 2.6.1
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.5
lxml.etree: 4.3.2
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.3.1
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: 0.2.0
fastparquet: 0.2.1
pandas_gbq: None
pandas_datareader: None
gcsfs: None

</details>



Discussion:

Resolving patch:
diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1015,7 +1015,7 @@ def __getitem__(self, value):
     def _format_with_header(self, header, **kwargs):
         return header + list(self._format_native_types(**kwargs))
 
-    def _format_native_types(self, na_rep='', quoting=None, **kwargs):
+    def _format_native_types(self, na_rep='NaN', quoting=None, **kwargs):
         """ actually format my specific types """
         from pandas.io.formats.format import ExtensionArrayFormatter
         return ExtensionArrayFormatter(values=self,


Test patch:
diff --git a/pandas/tests/indexes/interval/test_interval.py b/pandas/tests/indexes/interval/test_interval.py
--- a/pandas/tests/indexes/interval/test_interval.py
+++ b/pandas/tests/indexes/interval/test_interval.py
@@ -378,6 +378,23 @@ def test_frame_repr(self):
         )
         assert result == expected
 
+    @pytest.mark.parametrize('constructor,expected', [
+        (pd.Series, ('(0.0, 1.0]    a\n'
+                     'NaN           b\n'
+                     '(2.0, 3.0]    c\n'
+                     'dtype: object')),
+        (pd.DataFrame, ('            0\n'
+                        '(0.0, 1.0]  a\n'
+                        'NaN         b\n'
+                        '(2.0, 3.0]  c'))
+    ])
+    def test_repr_missing(self, constructor, expected):
+        # GH 25984
+        index = IntervalIndex.from_tuples([(0, 1), np.nan, (2, 3)])
+        obj = constructor(list('abc'), index=index)
+        result = repr(obj)
+        assert result == expected
+
         # TODO: check this behavior is consistent with test_interval_new.py
     def test_get_item(self, closed):
         i = IntervalIndex.from_arrays((0, 1, np.nan), (1, 2, np.nan),