code: def test_trials_dataframe_with_failure(storage_mode: str) -> None:
      def f(trial: Trial) -> float:
          x = trial.suggest_int("x", 1, 1)
          y = trial.suggest_categorical("y", (2.5,))
          trial.set_user_attr("train_loss", 3)
          raise ValueError()
          return x + y  # 3.5
  
      with StorageSupplier(storage_mode) as storage:
          study = create_study(storage=storage)
          study.optimize(f, n_trials=3, catch=(ValueError,))
          df = study.trials_dataframe()
          # Change index to access rows via trial number.
          df.set_index("number", inplace=True, drop=False)
          assert len(df) == 3
          # non-nested: 6, params: 2, user_attrs: 1 system_attrs: 0
          assert len(df.columns) == 9
          for i in range(3):
              assert df.number[i] == i
              assert df.state[i] == "FAIL"
              assert df.value[i] is None
              assert isinstance(df.datetime_start[i], pd.Timestamp)
              assert isinstance(df.datetime_complete[i], pd.Timestamp)
              assert isinstance(df.duration[i], pd.Timedelta)
              assert df.params_x[i] == 1
              assert df.params_y[i] == 2.5
              assert df.user_attrs_train_loss[i] == 3
  
file_path: optuna/tests/study_tests/test_dataframe.py
imports: from __future__ import annotations
  import pandas
  import pytest
  from optuna import create_study
  from optuna import create_trial
  from optuna import Trial
  from optuna.testing.storages import STORAGE_MODES
  from optuna.testing.storages import StorageSupplier
  from optuna.trial import TrialState
label_desc: Use image node_id 3 for calling a global function with example usage: test_trials_dataframe_with_failure(storage_mode) and returns: unknown