code: def test_index_names():
      """Test output if index is supplied."""
      df = pd.DataFrame(
          [
              {"stat": "mean", "score": 4, "var": "var1"},
              {"stat": "sd", "score": 7, "var": "var1"},
              {"stat": "mean", "score": 1, "var": "var2"},
              {"stat": "sd", "score": 2, "var": "var2"},
              {"stat": "mean", "score": 11, "var": "var3"},
              {"stat": "sd", "score": 14, "var": "var3"},
          ]
      )
  
      expected_output = pd.DataFrame(
          {
              "var": ["var1", "var2", "var3"],
              "mean": [4, 1, 11],
              "sd": [7, 2, 14],
          }
      )
  
      result = df.pivot_wider(
          index="var", names_from="stat", values_from="score"
      )
  
      assert_frame_equal(result, expected_output)
  
imports: import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
label_desc: Use image node_id 24 for calling a global function with example usage: test_index_names() without return types