code: def test_mean_on_timedelta():
      # GH 17382
      df = DataFrame(
          {"time": pd.to_timedelta(range(10)), "cat": ["A", "B"] * 5}
      )
      result = df.groupby("cat")["time"].mean()
      expected = Series(
          pd.to_timedelta([4, 5]),
          name="time",
          index=pd.Index(["A", "B"], name="cat"),
      )
      tm.assert_series_equal(result, expected)
  
imports: import builtins
  import datetime
  from string import ascii_lowercase
  import numpy
  import pytest
  from pandas._libs.tslibs import iNaT
  import pandas
  from pandas import DataFrame, MultiIndex, Series, Timestamp, date_range, isna
  import pandas._testing
  from pandas.util import _test_decorators
label_desc: Use image node_id 15 for calling a global function with example usage: test_mean_on_timedelta() without return types