class_docstr: DataContainer (dact) class to store IDs (ids), data inputs (di), and expected outputs (eo) together.
  In some dacts, you could have only ids and data inputs, and in other dacts you could have only expected outputs,
  or you could have all if you want, such as when your :class:`~neuraxle.pipeline.Pipeline` is used to train a model
  in a certain :class:`~neuraxle.base.ExecutionMode` within a certain :class:`~neuraxle.base.ExecutionContext`.
  
  You can use typing for your dact, and create a dact, such as:
  
  .. code-block:: python
  
      from typing import List
      from neuraxle.data_container import DataContainer as DACT
  
      dact: DACT[List[str], List[int], List[float]] = DACT(
          ids=['a', 'b', 'c'],
          data_inputs=[1, 2, 3],
          expected_outputs=[1.0, 2.0, 3.0]
      )
  
  
  This is because the DataContainer inherits from the :class:`~typing.Generic` type
  as ``class DataContainer(Generic[IDT, DIT, EOT]): ...``.
  
  The DataContainer object is passed to all of the :class:`~neuraxle.base.BaseStep` 's handle methods :
      * :func:`~neuraxle.base.BaseStep.handle_transform`
      * :func:`~neuraxle.base.BaseStep.handle_fit_transform`
      * :func:`~neuraxle.base.BaseStep.handle_fit`
  
  Most of the time, the steps will manage it in the handler methods.
  
  .. seealso::
      :class:`~neuraxle.base.BaseStep`,
      :class:`~neuraxle.data_container.StripAbsentValues`
class_docstr_tok: ["DataContainer","(","dact",")","class","to","store","IDs","(","ids",")",",","data","inputs","(","di",")",",","and","expected","outputs","(","eo",")","together",".","In","some","dacts",",","you","could","have","only","ids","and","data","inputs",",","and","in","other","dacts","you","could","have","only","expected","outputs",",","or","you","could","have","all","if","you","want",",","such","as","when","your",":","class",":","`","~neuraxle.pipeline.Pipeline","`","is","used","to","train","a","model","in","a","certain",":","class",":","`","~neuraxle.base.ExecutionMode","`","within","a","certain",":","class",":","`","~neuraxle.base.ExecutionContext","`",".","You","can","use","typing","for","your","dact",",","and","create","a","dact",",","such","as",":","..","code-block",":",":","python","from","typing","import","List","from","neuraxle.data_container","import","DataContainer","as","DACT","dact",":","DACT","[","List","[","str","]",",","List","[","int","]",",","List","[","float","]","]","=","DACT","(","ids=","[","'","a","'",",","'","b","'",",","'","c","'","]",",","data_inputs=","[","1",",","2",",","3","]",",","expected_outputs=","[","1.0",",","2.0",",","3.0","]",")","This","is","because","the","DataContainer","inherits","from","the",":","class",":","`","~typing.Generic","`","type","as","``","class","DataContainer","(","Generic","[","IDT",",","DIT",",","EOT","]",")",":","...","``",".","The","DataContainer","object","is","passed","to","all","of","the",":","class",":","`","~neuraxle.base.BaseStep","`","'s","handle","methods",":","*",":","func",":","`","~neuraxle.base.BaseStep.handle_transform","`","*",":","func",":","`","~neuraxle.base.BaseStep.handle_fit_transform","`","*",":","func",":","`","~neuraxle.base.BaseStep.handle_fit","`","Most","of","the","time",",","the","steps","will","manage","it","in","the","handler","methods",".","..","seealso",":",":",":","class",":","`","~neuraxle.base.BaseStep","`",",",":","class",":","`","~neuraxle.data_container.StripAbsentValues","`"]
docstr: Yields minibatches extracted from looping on the DataContainer's content with a batch_size and a certain behavior for the last batch when the batch_size is uneven with the total size.
  
  Note that the default value for IDs is None.
  
  .. code-block:: python
  
      data_container = DataContainer(data_inputs=np.array(list(range(10)))
      for data_container_batch in data_container.minibatches(batch_size=2):
          print(data_container_batch.data_inputs)
          print(data_container_batch.expected_outputs)
      # [array([0, 1]), array([2, 3]), ..., array([8, 9])]
  
      data_container = DataContainer(data_inputs=np.array(list(range(10)))
      for data_container_batch in data_container.minibatches(batch_size=3, keep_incomplete_batch=False):
          print(data_container_batch.data_inputs)
      # [array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8])]
  
      data_container = DataContainer(data_inputs=np.array(list(range(10)))
      for data_container_batch in data_container.minibatches(
          batch_size=3,
          keep_incomplete_batch=True,
          default_value_data_inputs=None,
          default_value_expected_outputs=None
      ):
          print(data_container_batch.data_inputs)
      # [array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]), array([9, None, None])]
  
      data_container = DataContainer(data_inputs=np.array(list(range(10)))
      for data_container_batch in data_container.minibatches(
          batch_size=3,
          keep_incomplete_batch=True,
          default_value_data_inputs=StripAbsentValues()
      ):
          print(data_container_batch.data_inputs)
      # [array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]), array([9])]
  
  
  :param batch_size: number of elements to combine into a single batch
  :param keep_incomplete_batch: (Optional.) A bool representing
  whether the last batch should be dropped in the case it has fewer than
  `batch_size` elements; the default behavior is to keep the smaller
  batch.
  :param default_value_data_inputs: expected_outputs default fill value
  for padding and values outside iteration range, or :class:`~neuraxle.data_container.StripAbsentValues`
  to trim absent values from the batch
  :param default_value_expected_outputs: expected_outputs default fill value
  for padding and values outside iteration range, or :class:`~neuraxle.data_container.StripAbsentValues`
  to trim absent values from the batch
  :return: an iterator of DataContainer
  
  .. seealso::
      :class:`~neuraxle.data_container.StripAbsentValues`
docstr_tok: ["Yields","minibatches","extracted","from","looping","on","the","DataContainer","'s","content","with","a","batch_size","and","a","certain","behavior","for","the","last","batch","when","the","batch_size","is","uneven","with","the","total","size",".","Note","that","the","default","value","for","IDs","is","None",".","..","code-block",":",":","python","data_container","=","DataContainer","(","data_inputs=np.array","(","list","(","range","(","10",")",")",")","for","data_container_batch","in","data_container.minibatches","(","batch_size=2",")",":","print","(","data_container_batch.data_inputs",")","print","(","data_container_batch.expected_outputs",")","#","[","array","(","[","0",",","1","]",")",",","array","(","[","2",",","3","]",")",",","...",",","array","(","[","8",",","9","]",")","]","data_container","=","DataContainer","(","data_inputs=np.array","(","list","(","range","(","10",")",")",")","for","data_container_batch","in","data_container.minibatches","(","batch_size=3",",","keep_incomplete_batch=False",")",":","print","(","data_container_batch.data_inputs",")","#","[","array","(","[","0",",","1",",","2","]",")",",","array","(","[","3",",","4",",","5","]",")",",","array","(","[","6",",","7",",","8","]",")","]","data_container","=","DataContainer","(","data_inputs=np.array","(","list","(","range","(","10",")",")",")","for","data_container_batch","in","data_container.minibatches","(","batch_size=3",",","keep_incomplete_batch=True",",","default_value_data_inputs=None",",","default_value_expected_outputs=None",")",":","print","(","data_container_batch.data_inputs",")","#","[","array","(","[","0",",","1",",","2","]",")",",","array","(","[","3",",","4",",","5","]",")",",","array","(","[","6",",","7",",","8","]",")",",","array","(","[","9",",","None",",","None","]",")","]","data_container","=","DataContainer","(","data_inputs=np.array","(","list","(","range","(","10",")",")",")","for","data_container_batch","in","data_container.minibatches","(","batch_size=3",",","keep_incomplete_batch=True",",","default_value_data_inputs=StripAbsentValues","(",")",")",":","print","(","data_container_batch.data_inputs",")","#","[","array","(","[","0",",","1",",","2","]",")",",","array","(","[","3",",","4",",","5","]",")",",","array","(","[","6",",","7",",","8","]",")",",","array","(","[","9","]",")","]",":","param","batch_size",":","number","of","elements","to","combine","into","a","single","batch",":","param","keep_incomplete_batch",":","(","Optional",".",")","A","bool","representing","whether","the","last","batch","should","be","dropped","in","the","case","it","has","fewer","than","`","batch_size","`","elements",";","the","default","behavior","is","to","keep","the","smaller","batch",".",":","param","default_value_data_inputs",":","expected_outputs","default","fill","value","for","padding","and","values","outside","iteration","range",",","or",":","class",":","`","~neuraxle.data_container.StripAbsentValues","`","to","trim","absent","values","from","the","batch",":","param","default_value_expected_outputs",":","expected_outputs","default","fill","value","for","padding","and","values","outside","iteration","range",",","or",":","class",":","`","~neuraxle.data_container.StripAbsentValues","`","to","trim","absent","values","from","the","batch",":","return",":","an","iterator","of","DataContainer","..","seealso",":",":",":","class",":","`","~neuraxle.data_container.StripAbsentValues","`"]
code: def minibatches(
      self,
      batch_size: int,
      keep_incomplete_batch: bool = True,
      default_value_data_inputs=None,
      default_value_expected_outputs=None,
  ) -> Iterable["DACT[IDT, DIT, EOT]"]:
      """
      Yields minibatches extracted from looping on the DataContainer's content with a batch_size and a certain behavior for the last batch when the batch_size is uneven with the total size.
  
      Note that the default value for IDs is None.
  
      .. code-block:: python
  
          data_container = DataContainer(data_inputs=np.array(list(range(10)))
          for data_container_batch in data_container.minibatches(batch_size=2):
              print(data_container_batch.data_inputs)
              print(data_container_batch.expected_outputs)
          # [array([0, 1]), array([2, 3]), ..., array([8, 9])]
  
          data_container = DataContainer(data_inputs=np.array(list(range(10)))
          for data_container_batch in data_container.minibatches(batch_size=3, keep_incomplete_batch=False):
              print(data_container_batch.data_inputs)
          # [array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8])]
  
          data_container = DataContainer(data_inputs=np.array(list(range(10)))
          for data_container_batch in data_container.minibatches(
              batch_size=3,
              keep_incomplete_batch=True,
              default_value_data_inputs=None,
              default_value_expected_outputs=None
          ):
              print(data_container_batch.data_inputs)
          # [array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]), array([9, None, None])]
  
          data_container = DataContainer(data_inputs=np.array(list(range(10)))
          for data_container_batch in data_container.minibatches(
              batch_size=3,
              keep_incomplete_batch=True,
              default_value_data_inputs=StripAbsentValues()
          ):
              print(data_container_batch.data_inputs)
          # [array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]), array([9])]
  
  
      :param batch_size: number of elements to combine into a single batch
      :param keep_incomplete_batch: (Optional.) A bool representing
      whether the last batch should be dropped in the case it has fewer than
      `batch_size` elements; the default behavior is to keep the smaller
      batch.
      :param default_value_data_inputs: expected_outputs default fill value
      for padding and values outside iteration range, or :class:`~neuraxle.data_container.StripAbsentValues`
      to trim absent values from the batch
      :param default_value_expected_outputs: expected_outputs default fill value
      for padding and values outside iteration range, or :class:`~neuraxle.data_container.StripAbsentValues`
      to trim absent values from the batch
      :return: an iterator of DataContainer
  
      .. seealso::
          :class:`~neuraxle.data_container.StripAbsentValues`
      """
      for i in range(0, len(self.data_inputs), batch_size):
          data_container: DACT[IDT, DIT, EOT] = DACT(
              ids=self.ids[i : i + batch_size]
              if self._ids is not None
              else None,
              data_inputs=self.di[i : i + batch_size]
              if self.data_inputs is not None
              else None,
              expected_outputs=self.eo[i : i + batch_size]
              if self.expected_outputs is not None
              else None,
          )
  
          incomplete_batch = (
              len(data_container.data_inputs) < batch_size
          )
          if incomplete_batch:
              if not keep_incomplete_batch:
                  break
  
              data_container = _pad_or_keep_incomplete_batch(
                  data_container,
                  batch_size,
                  default_value_data_inputs,
                  default_value_expected_outputs,
              )
  
          yield data_container
  
imports: import copy
  import math
  from operator import attrgetter
  from typing import Any, Callable, Generic, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
  import numpy
  import pandas
label_desc: Use image node_id 23 for calling the DataContainer obj's underlying member method code with example usage: obj.minibatches(batch_size, keep_incomplete_batch, default_value_data_inputs, default_value_expected_outputs) without return types