code: def _extract_datetime_features(x_df):
      """Extract datetime features e.g., hour, day_of_week, from datetime index.
  
      Parameters
      ----------
      x_df : DataFrame
          Dataframe with time index
  
      Returns
      -------
      calendar_features : DataFrame
           DataFrame with new columns (hour, day_of_week, day_of_year, week_of_year
           month_of_year, quarter, year)
      """
      date_sequence = x_df["date_sequence"]
      calendar_features = pd.DataFrame()
      calendar_features["hour"] = date_sequence.dt.hour
      calendar_features["day_of_week"] = date_sequence.dt.dayofweek
      calendar_features["day_of_year"] = date_sequence.dt.dayofyear
      calendar_features[
          "week_of_year"
      ] = date_sequence.dt.isocalendar().week
      calendar_features["month_of_year"] = date_sequence.dt.month
      calendar_features["quarter"] = date_sequence.dt.quarter
      calendar_features["year"] = date_sequence.dt.year
      return calendar_features
  
file_path: sktime/sktime/transformations/series/peak.py
imports: import pandas
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 2 for calling a global function with example usage: _extract_datetime_features(x_df) and returns: calendar_features