code: def test_find_index():
      index = date_range("2000-01-01", periods=5000)
      series = Series(np.arange(len(index)), index=index, name="test")
      df = DataFrame(series)
      assert_equal(find_index(series, "2000-01-01"), 0)
      assert_equal(find_index(series, series.index[0]), 0)
      assert_equal(find_index(series, series.index[3000]), 3000)
      assert_equal(
          find_index(series, series.index[3000].to_pydatetime()), 3000
      )
      npy_date = np.datetime64(series.index[3000].to_pydatetime())
      found_loc = find_index(series, npy_date)
      assert_equal(found_loc, 3000)
      with pytest.raises(ValueError):
          find_index(series, "bad-date")
      with pytest.raises(ValueError):
          find_index(series, "1900-01-01")
  
      assert_equal(find_index(df, "2000-01-01"), 0)
      assert_equal(find_index(df, df.index[0]), 0)
      assert_equal(find_index(df, df.index[3000]), 3000)
      assert_equal(find_index(df, df.index[3000].to_pydatetime()), 3000)
      found_loc = find_index(
          df, np.datetime64(df.index[3000].to_pydatetime())
      )
      assert_equal(found_loc, 3000)
      with pytest.raises(ValueError):
          find_index(df, "bad-date")
      with pytest.raises(ValueError):
          find_index(df, "1900-01-01")
  
      idx = find_index(df, 1)
      assert idx == 1
  
imports: from abc import abstractmethod
  import datetime
  import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_equal
  from pandas import DataFrame, Series, Timedelta, date_range
  import pytest
  from arch import doc
  from arch.univariate.base import implicit_constant
  from arch.utility.array import ConcreteClassMeta, DocStringInheritor, cutoff_to_index, date_to_index, ensure1d, ensure2d, find_index, parse_dataframe
label_desc: Use image node_id 11 for calling a global function with example usage: test_find_index() without return types