code: def test__determine_case_and_prepare_df():
      from dtale.ppscore.calculation import (
          _determine_case_and_prepare_df,
      )
  
      df = pd.read_csv(
          os.path.join(
              os.path.dirname(__file__), "..", "..", "data/titanic.csv"
          )
      )
      df = df.rename(
          columns={
              "Age": "Age_float",
              "Pclass": "Pclass_integer",
              "Survived": "Survived_integer",
              "Ticket": "Ticket_object",
              "Name": "Name_object_id",
          }
      )
  
      df["x"] = 1  # x is irrelevant for this test
      df["constant"] = 1
      df["Pclass_category"] = df["Pclass_integer"].astype("category")
      df["Pclass_datetime"] = pd.to_datetime(
          df["Pclass_integer"], infer_datetime_format=True
      )
      df["Survived_boolean"] = df["Survived_integer"].astype(bool)
      df["Cabin_string"] = pd.Series(
          df["Cabin"].apply(str),
          dtype="string" if check_pandas_version("1.1.0") else "object",
      )
  
      # check regression
      assert (
          _determine_case_and_prepare_df(df, "x", "Age_float")[1]
          == "regression"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "Pclass_integer")[1]
          == "regression"
      )
  
      # check classification
      assert (
          _determine_case_and_prepare_df(df, "x", "Pclass_category")[1]
          == "classification"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "Survived_boolean")[1]
          == "classification"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "Ticket_object")[1]
          == "classification"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "Cabin_string")[1]
          == "classification"
      )
  
      # check special cases
      assert (
          _determine_case_and_prepare_df(df, "Name_object_id", "x")[1]
          == "feature_is_id"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "x")[1]
          == "predict_itself"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "constant")[1]
          == "target_is_constant"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "Name_object_id")[1]
          == "target_is_id"
      )
      assert (
          _determine_case_and_prepare_df(df, "x", "Pclass_datetime")[1]
          == "target_is_datetime"
      )
  
file_path: dtale/tests/dtale/ppscore/test_calculation.py
imports: import os
  import pytest
  import pandas
  import numpy
  import sys
  import dtale.ppscore
  from dtale.pandas_util import check_pandas_version
label_desc: Use image node_id 3 for calling a global function with example usage: test__determine_case_and_prepare_df() without return types