code: def enhance_intraday_data(df):
      r"""Add columns to the intraday dataframe.
  
      Parameters
      ----------
      df : pandas.DataFrame
          The intraday dataframe.
  
      Returns
      -------
      df : pandas.DataFrame
          The dataframe with bar number and end-of-day columns.
  
      """
  
      # Group by date first
  
      df["date"] = df.index.strftime("%Y-%m-%d")
      date_group = df.groupby("date")
  
      # Number the intraday bars
      df["bar_number"] = date_group.cumcount()
  
      # Mark the end of the trading day
  
      df["end_of_day"] = False
      df.loc[date_group.tail(1).index, "end_of_day"] = True
  
      # Return the enhanced frame
  
      del df["date"]
      return df
  
imports: from alphapy.frame import Frame
  from alphapy.frame import frame_name
  from alphapy.frame import read_frame
  from alphapy.globals import ModelType
  from alphapy.globals import Partition, datasets
  from alphapy.globals import PSEP, SSEP, USEP
  from alphapy.globals import SamplingMethod
  from alphapy.globals import WILDCARD
  from alphapy.space import Space
  import arrow
  from datetime import datetime
  from datetime import timedelta
  from iexfinance.stocks import get_historical_data
  from iexfinance.stocks import get_historical_intraday
  from imblearn.combine import SMOTEENN
  from imblearn.combine import SMOTETomek
  import imblearn.ensemble
  from imblearn.over_sampling import RandomOverSampler
  from imblearn.over_sampling import SMOTE
  from imblearn.under_sampling import ClusterCentroids
  from imblearn.under_sampling import CondensedNearestNeighbour
  from imblearn.under_sampling import EditedNearestNeighbours
  from imblearn.under_sampling import InstanceHardnessThreshold
  from imblearn.under_sampling import NearMiss
  from imblearn.under_sampling import NeighbourhoodCleaningRule
  from imblearn.under_sampling import OneSidedSelection
  from imblearn.under_sampling import RandomUnderSampler
  from imblearn.under_sampling import RepeatedEditedNearestNeighbours
  from imblearn.under_sampling import TomekLinks
  import logging
  import math
  import numpy
  import os
  import pandas
  import pandas_datareader.data
  import re
  import requests
  from scipy import sparse
  from sklearn.preprocessing import LabelEncoder
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: enhance_intraday_data(df) and returns: df