code: def _calendar_dummies(x, funcs):
      date_sequence = x["date_sequence"].dt
      if funcs == "week_of_year":
          # The first week of an ISO year is the first (Gregorian)
          # calendar week of a year containing a Thursday.
          # So it is possible that a week in the new year is still
          # indexed starting in last year (week 52 or 53)
          cd = date_sequence.isocalendar()["week"]
      elif funcs == "week_of_month":
          cd = (date_sequence.day - 1) // 7 + 1
      elif funcs == "month_of_quarter":
          cd = (date_sequence.month.astype(np.int64) + 2) % 3 + 1
      elif funcs == "week_of_quarter":
          col_names = x.columns
          x_columns = col_names.intersection(
              ["year", "quarter", "week"]
          ).to_list()
          x_columns.append("date_sequence")
          df = x.copy(deep=True)
          df = df[x_columns]
          if "year" not in x_columns:
              df["year"] = df["date_sequence"].dt.year
          if "quarter" not in x_columns:
              df["quarter"] = df["date_sequence"].dt.quarter
          if "week" not in x_columns:
              df["week"] = df["date_sequence"].dt.isocalendar()["week"]
          df["qdate"] = (
              df["date_sequence"]
              + pd.tseries.offsets.DateOffset(days=1)
          ) - pd.tseries.offsets.QuarterBegin(startingMonth=1)
          df["qweek"] = df["qdate"].dt.isocalendar()["week"]
          df.loc[(df["quarter"] == 1) & (df["week"] < 52), "qweek"] = 0
          cd = df["week"] - df["qweek"] + 1
      elif funcs == "millisecond":
          cd = date_sequence.microsecond * 1000
      elif funcs == "day_of_quarter":
          quarter = date_sequence.quarter
          quarter_start = pd.DatetimeIndex(
              date_sequence.year.map(str)
              + "-"
              + (3 * quarter - 2).map(int).map(str)
              + "-01"
          )
          values = (
              (x["date_sequence"] - quarter_start)
              / pd.to_timedelta("1D")
              + 1
          ).astype(int)
          cd = values
      elif funcs == "hour_of_week":
          cd = date_sequence.day_of_week * 24 + date_sequence.hour
      elif funcs == "is_weekend":
          cd = date_sequence.day_of_week > 4
      else:
          cd = getattr(date_sequence, funcs)
      cd = pd.DataFrame(cd)
      cd = cd.rename(columns={cd.columns[0]: funcs})
      cd[funcs] = np.int64(cd[funcs])
      return cd
  
file_path: sktime/sktime/transformations/series/date.py
imports: import warnings
  import numpy
  import pandas
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 4 for calling a global function with example usage: _calendar_dummies(x, funcs) and returns: cd