code: def test_split_to_dataframe_with_index(any_string_dtype):
      s = Series(
          ["some_splits", "with_index"],
          index=["preserve", "me"],
          dtype=any_string_dtype,
      )
      result = s.str.split("_", expand=True)
      exp = DataFrame(
          {0: ["some", "with"], 1: ["splits", "index"]},
          index=["preserve", "me"],
          dtype=any_string_dtype,
      )
      tm.assert_frame_equal(result, exp)
  
      with pytest.raises(ValueError, match="expand must be"):
          s.str.split("_", expand="not_a_boolean")
  
imports: from datetime import datetime
  import re
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, MultiIndex, Series, _testing
  from pandas.tests.strings import _convert_na_value, object_pyarrow_numpy
label_desc: Use image node_id 18 for calling a global function with example usage: test_split_to_dataframe_with_index(any_string_dtype) without return types