code: def test_remove_unused_levels_with_nan():
      # GH 37510
      idx = Index([(1, np.nan), (3, 4)]).rename(["id1", "id2"])
      idx = idx.set_levels(["a", np.nan], level="id1")
      idx = idx.remove_unused_levels()
      result = idx.levels
      expected = FrozenList([["a", np.nan], [4]])
      assert str(result) == str(expected)
  
imports: import numpy
  import pytest
  from pandas.errors import PerformanceWarning, UnsortedIndexError
  from pandas import CategoricalIndex, DataFrame, Index, MultiIndex, RangeIndex, Series, Timestamp
  import pandas._testing
  from pandas.core.indexes.frozen import FrozenList
label_desc: Use image node_id 13 for calling a global function with example usage: test_remove_unused_levels_with_nan() without return types