code: def __init__(self, data_source):
      self.data_source = data_source
      # calculate number of samples in each batch
      self.daily_count = (
          pd.Series(index=self.data_source.get_index())
          .groupby("datetime")
          .size()
          .values
      )
      self.daily_index = np.roll(
          np.cumsum(self.daily_count), 1
      )  # calculate begin index of each batch
      self.daily_index[0] = 0
  
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  import pandas
  import copy
  from ...utils import get_or_create_path
  from ...log import get_module_logger
  import torch
  import torch.nn
  import torch.optim
  from torch.utils.data import DataLoader
  from torch.utils.data import Sampler
  from .pytorch_utils import count_parameters
  from ...model.base import Model
  from ...data.dataset.handler import DataHandlerLP
  from ...contrib.model.pytorch_lstm import LSTMModel
  from ...contrib.model.pytorch_gru import GRUModel
label_desc: Use image node_id 1 to create a new DailyBatchSampler object from inherited base classes: Sampler with example: obj = DailyBatchSampler(data_source)