code: def test_pandas_endog():
      # Test various types of pandas endog inputs (e.g. TimeSeries, etc.)
  
      # Example (failure): pandas.Series, no dates
      endog = pd.Series([1.0, 2.0])
      # raises error due to no dates
      warnings.simplefilter("always")
      # assert_raises(ValueError, check_endog, endog, **kwargs)
  
      # Example : pandas.Series
      dates = pd.date_range(
          start="1980-01-01", end="1981-01-01", freq="YS"
      )
      endog = pd.Series([1.0, 2.0], index=dates)
      mod = check_endog(endog, **kwargs)
      mod.filter([])
  
      # Example : pandas.Series, string datatype
      endog = pd.Series(["a", "b"], index=dates)
      # raises error due to direct type casting check in statsmodels base classes
      assert_raises(ValueError, check_endog, endog, **kwargs)
  
      # Example : pandas.Series
      endog = pd.Series([1.0, 2.0], index=dates)
      mod = check_endog(endog, **kwargs)
      mod.filter([])
  
      # Example : pandas.DataFrame with 1 column
      endog = pd.DataFrame({"a": [1.0, 2.0]}, index=dates)
      mod = check_endog(endog, **kwargs)
      mod.filter([])
  
      # Example (failure): pandas.DataFrame with 2 columns
      endog = pd.DataFrame(
          {"a": [1.0, 2.0], "b": [3.0, 4.0]}, index=dates
      )
      # raises error because 2-columns means k_endog=2, but the design matrix
      # set in **kwargs is shaped (1, 1)
      assert_raises(ValueError, check_endog, endog, **kwargs)
  
      # Check behavior of the link maintained between passed `endog` and
      # `mod.endog` arrays
      endog = pd.DataFrame({"a": [1.0, 2.0]}, index=dates)
      mod = check_endog(endog, **kwargs)
      assert_equal(mod.endog.base is not mod.data.orig_endog, True)
      assert_equal(mod.endog.base is not endog, True)
      assert_equal(mod.data.orig_endog.values.base is not endog, True)
      endog.iloc[0, 0] = 2
      # there is no link to mod.endog
      assert_equal(mod.endog, np.r_[1, 2].reshape(2, 1))
      # there remains a link to mod.data.orig_endog
      assert_allclose(mod.data.orig_endog, endog)
  
      # Example : pandas.DataFrame with 2 columns
      # Update kwargs for k_endog=2
      kwargs2 = {
          "k_states": 1,
          "design": [[1], [0.0]],
          "obs_cov": [[1, 0], [0, 1]],
          "transition": [[1]],
          "selection": [[1]],
          "state_cov": [[1]],
          "initialization": "approximate_diffuse",
      }
      endog = pd.DataFrame(
          {"a": [1.0, 2.0], "b": [3.0, 4.0]}, index=dates
      )
      mod = check_endog(endog, k_endog=2, **kwargs2)
      mod.filter([])
  
imports: from statsmodels.compat.pandas import MONTH_END
  import os
  import re
  import warnings
  import numpy
  from numpy.testing import assert_, assert_allclose, assert_almost_equal, assert_equal, assert_raises
  import pandas
  import pytest
  from statsmodels.datasets import nile
  from statsmodels.tsa.statespace import kalman_filter, kalman_smoother, sarimax, varmax
  from statsmodels.tsa.statespace.mlemodel import MLEModel, MLEResultsWrapper
  from statsmodels.tsa.statespace.tests.results import results_sarimax, results_var_misc
label_desc: Use image node_id 21 for calling a global function with example usage: test_pandas_endog() without return types