code: def to_daily_packets(df: pd.DataFrame):
      volume = np.array(df["Volume"], dtype=float)
      time = np.array(df["Minute"])
      candles = np.zeros((len(df), 6), dtype=float)
      candles[:, CandleIdx.high] = np.array(df["High"])
      candles[:, CandleIdx.low] = np.array(df["Low"])
      candles[:, CandleIdx.open] = np.array(df["Open"])
      candles[:, CandleIdx.close] = np.array(df["Close"])
      candles[:, CandleIdx.volume] = volume
      candles[:, 5] = time
  
      dates = []
      packets = []
      current_day = None
      packet = None
      for i in monit.iterate("To daily packets", len(df)):
          d = df["Date"][i]
          if d != current_day:
              if current_day is not None:
                  dates.append(current_day)
                  packets.append(packet)
              current_day = d
              packet = np.zeros((390, 5), dtype=float)
          t = time[i]
          if 0 <= t < 390:
              packet[t, :] = candles[i, 0:5]
      if current_day is not None:
          dates.append(current_day)
          packets.append(packet)
  
      return np.array(dates), np.array(packets)
  
file_path: labml/samples/stocks/build_numpy_cache.py
imports: import urllib.request
  import numpy
  import pandas
  from labml import monit, lab, logger
  from stocks import CandleIdx
label_desc: Use image node_id 3 for calling a global function with example usage: to_daily_packets(df) and returns: np,  np