code: def test_index_single_data(self):
      # Auto broadcast for scalar
      sd = idd.SingleData(0, index=["foo", "bar"])
      print(sd)
  
      # Support empty value
      sd = idd.SingleData()
      print(sd)
  
      # Bad case: the input is not aligned
      with self.assertRaises(ValueError):
          idd.SingleData(range(10), index=["foo", "bar"])
  
      # test indexing
      sd = idd.SingleData([1, 2, 3, 4], index=["foo", "bar", "f", "g"])
      print(sd)
      print(sd.iloc[1])  # get second row
  
      # Bad case: it is not in the index
      with self.assertRaises(KeyError):
          print(sd.loc[1])
  
      print(sd.loc["foo"])
  
      # Test slicing
      print(sd.loc[:"bar"])
  
      print(sd.iloc[:3])
  
file_path: qlib/tests/misc/test_index_data.py
imports: import numpy
  import pandas
  import qlib.utils.index_data
  import unittest
label_desc: Use image node_id 1 for calling the IndexDataTest obj's underlying member method code with example usage: obj.test_index_single_data() without return types