docstr: Helper function that adds columns relevant to a date in the column `field_name` of `df`.
  
  Args:
      df (DataFrame): Dataframe
  
      field_name (str): Date field name
  
      frequency (str): Frequency string of the form `[multiple][granularity]` such as "12H", "5min", "1D" etc.
  
      prefix (str, optional): Prefix to add to the new columns. Defaults to None.
  
      drop (bool, optional): Drop the original column. Defaults to True.
  
  Returns:
      Dataframe with added columns and list of added columns
docstr_tok: ["Helper","function","that","adds","columns","relevant","to","a","date","in","the","column","`","field_name","`","of","`","df","`",".","Args",":","df","(","DataFrame",")",":","Dataframe","field_name","(","str",")",":","Date","field","name","frequency","(","str",")",":","Frequency","string","of","the","form","`","[","multiple","]","[","granularity","]","`","such","as","``","12H","''",",","``","5min","''",",","``","1D","''","etc",".","prefix","(","str",",","optional",")",":","Prefix","to","add","to","the","new","columns",".","Defaults","to","None",".","drop","(","bool",",","optional",")",":","Drop","the","original","column",".","Defaults","to","True",".","Returns",":","Dataframe","with","added","columns","and","list","of","added","columns"]
code: def add_datepart(
      cls,
      df: DataFrame,
      field_name: str,
      frequency: str,
      prefix: str = None,
      drop: bool = True,
  ) -> Tuple[DataFrame, List[str]]:
      """Helper function that adds columns relevant to a date in the column `field_name` of `df`.
  
      Args:
          df (DataFrame): Dataframe
  
          field_name (str): Date field name
  
          frequency (str): Frequency string of the form `[multiple][granularity]` such as "12H", "5min", "1D" etc.
  
          prefix (str, optional): Prefix to add to the new columns. Defaults to None.
  
          drop (bool, optional): Drop the original column. Defaults to True.
  
      Returns:
          Dataframe with added columns and list of added columns
      """
      field = df[field_name]
      prefix = (
          re.sub("[Dd]ate$", "", field_name)
          if prefix is None
          else prefix
      ) + "_"
      attr = cls.time_features_from_frequency_str(frequency)
      added_features = []
      for n in attr:
          if n == "Week":
              continue
          df[prefix + n] = getattr(field.dt, n.lower())
          added_features.append(prefix + n)
      # Pandas removed `dt.week` in v1.1.10
      if "Week" in attr:
          week = (
              field.dt.isocalendar().week
              if hasattr(field.dt, "isocalendar")
              else field.dt.week
          )
          df.insert(3, prefix + "Week", week)
          added_features.append(prefix + "Week")
      # TODO Not adding Elapsed by default. Need to route it through config
      # mask = ~field.isna()
      # df[prefix + "Elapsed"] = np.where(
      #     mask, field.values.astype(np.int64) // 10 ** 9, None
      # )
      # added_features.append(prefix + "Elapsed")
      if drop:
          df.drop(field_name, axis=1, inplace=True)
  
      # Removing features woth zero variations
      # for col in added_features:
      #     if len(df[col].unique()) == 1:
      #         df.drop(columns=col, inplace=True)
      #         added_features.remove(col)
      return df, added_features
  
imports: import re
  import warnings
  from enum import Enum
  from pathlib import Path
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  import joblib
  import numpy
  import pandas
  import pytorch_lightning
  import torch
  from omegaconf import DictConfig
  from pandas import DataFrame, DatetimeTZDtype, to_datetime
  from pandas.tseries import offsets
  from pandas.tseries.frequencies import to_offset
  from sklearn.base import TransformerMixin, copy
  from sklearn.preprocessing import FunctionTransformer, LabelEncoder, PowerTransformer, QuantileTransformer, StandardScaler
  from torch.utils.data import DataLoader, Dataset
  from pytorch_tabular.config import InferredConfig
  from pytorch_tabular.utils import get_logger
  from .categorical_encoders import OrdinalEncoder
label_desc: Use image node_id 29 for calling the TabularDatamodule obj's underlying member method code with example usage: obj.add_datepart(cls, df, field_name, frequency, prefix, drop) and returns: df,  added_features