code: def test_with_pandas_index(self) -> None:
      fruits = [
          "Apples",
          "Pears",
          "Nectarines",
          "Plums",
          "Grapes",
          "Strawberries",
      ]
      years = ["2015", "2016", "2017"]
      data = {
          "2015": [2, 1, 4, 3, 2, 4],
          "2016": [5, 3, 3, 2, 4, 6],
          "2017": [3, 2, 4, 4, 5, 3],
      }
  
      df = pd.DataFrame(data, index=fruits)
      fruits = df.index
      years = df.columns
      m = bmm.CategoricalColorMapper(
          palette=Spectral6, factors=years, start=1, end=2
      )
      assert list(m.factors) == list(years)
      assert isinstance(m.factors, pd.Index)
  
imports: from __future__ import annotations
  import pytest
  from unittest.mock import MagicMock, patch
  import pandas
  from bokeh.core.validation import check_integrity, process_validation_issues
  from bokeh.palettes import Spectral6
  from _util_models import check_properties_existence
  import bokeh.models.mappers
label_desc: Use image node_id 4 for calling the Test_CategoricalColorMapper obj's underlying member method code with example usage: obj.test_with_pandas_index() without return types