pydata/pandas — pull request #5090 by goyodiaz (2013-10-02 21:44:18+00:00)
Title: BUG: MultiIndex.get_level_values() replaces NA by another value (#5074)

Do you really prefer using a mask? It seems to have a lower memory footprint but it requires some tricks for corner cases.
```
num = self._get_level_number(level)
unique_vals = self.levels[num] # .values
labels = self.labels[num]
mask = labels == -1
if len(unique_vals) > 0:
values = unique_vals.take(labels)
else:
values = np.empty(len(labels))
values[:] = np.nan
values = pd.Index(values)
if mask.any():
values = values.get_values()
values[mask] = np.nan
values = pd.Index(values)
values.name = self.names[num]
return values
```