code: def resample_calendar(df: pd.DataFrame, offset: str) -> pd.DataFrame:
      """Resample the DataFrame by calendar offset.
      See http://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#anchored-offsets for compatible offsets.
      :param df: data
      :param offset: calendar offset
      :return: result DataFrame
      """
  
      d = {
          "open": "first",
          "high": "max",
          "low": "min",
          "close": "last",
          "volume": "sum",
      }
  
      return df.resample(offset).agg(d)
  
imports: import pandas
label_desc: Use image node_id 3 for calling a global function with example usage: resample_calendar(df, offset) and returns: df