code: def test_imputation_of_numerical_vars_cast_as_object_and_returned_as_object(
      df_na,
  ):
      # test case 6: imputing of numerical variables cast as object + return as object
      # after imputation
      df_na = df_na.copy()
      df_na["Marks"] = df_na["Marks"].astype("O")
      imputer = CategoricalImputer(
          imputation_method="frequent",
          variables=["City", "Studies", "Marks"],
          return_object=True,
      )
      X_transformed = imputer.fit_transform(df_na)
      assert X_transformed["Marks"].dtype == "O"
  
file_path: feature_engine/tests/test_imputation/test_categorical_imputer.py
imports: import pandas
  import pytest
  from feature_engine.imputation import CategoricalImputer
label_desc: Use image node_id 6 for calling a global function with example usage: test_imputation_of_numerical_vars_cast_as_object_and_returned_as_object(df_na) without return types