class_docstr: A dataset type based on ``pandas.DataFrame``.
  
  This class is constructed with a collection of ``pandas.DataFrame``
  objects where each ``DataFrame`` is representing one time series.
  Both ``target`` and ``timestamp`` columns are essential. Dynamic features
  of a series can be specified with together with the series' ``DataFrame``,
  while static features can be specified in a separate ``DataFrame`` object
  via the ``static_features`` argument.
  
  Parameters
  ----------
  dataframes
      Single ``pd.DataFrame``/``pd.Series`` or a collection as list or dict
      containing at least ``timestamp`` and ``target`` values.
      If a dict is provided, the key will be the associated ``item_id``.
  target
      Name of the column that contains the ``target`` time series.
      For multivariate targets, a list of column names should be provided.
  timestamp
      Name of the column that contains the timestamp information.
  freq
      Frequency of observations in the time series. Must be a valid pandas
      frequency.
  feat_dynamic_real
      List of column names that contain dynamic real features.
  past_feat_dynamic_real
      List of column names that contain dynamic real features only available
      in the past.
  static_features
      ``pd.DataFrame`` containing static features for the series. The index
      should contain the key of the series in the ``dataframes`` argument.
  future_length
      For target and past dynamic features last ``future_length``
      elements are removed when iterating over the data set.
  unchecked
      Whether consistency checks on indexes should be skipped.
      (Default: ``False``)
  assume_sorted
      Whether to assume that indexes are sorted by time, and skip sorting.
      (Default: ``False``)
class_docstr_tok: ["A","dataset","type","based","on","``","pandas.DataFrame","``",".","This","class","is","constructed","with","a","collection","of","``","pandas.DataFrame","``","objects","where","each","``","DataFrame","``","is","representing","one","time","series",".","Both","``","target","``","and","``","timestamp","``","columns","are","essential",".","Dynamic","features","of","a","series","can","be","specified","with","together","with","the","series","'","``","DataFrame","``",",","while","static","features","can","be","specified","in","a","separate","``","DataFrame","``","object","via","the","``","static_features","``","argument",".","Parameters","--","--","--","--","--","dataframes","Single","``","pd.DataFrame","``","\/","``","pd.Series","``","or","a","collection","as","list","or","dict","containing","at","least","``","timestamp","``","and","``","target","``","values",".","If","a","dict","is","provided",",","the","key","will","be","the","associated","``","item_id","``",".","target","Name","of","the","column","that","contains","the","``","target","``","time","series",".","For","multivariate","targets",",","a","list","of","column","names","should","be","provided",".","timestamp","Name","of","the","column","that","contains","the","timestamp","information",".","freq","Frequency","of","observations","in","the","time","series",".","Must","be","a","valid","pandas","frequency",".","feat_dynamic_real","List","of","column","names","that","contain","dynamic","real","features",".","past_feat_dynamic_real","List","of","column","names","that","contain","dynamic","real","features","only","available","in","the","past",".","static_features","``","pd.DataFrame","``","containing","static","features","for","the","series",".","The","index","should","contain","the","key","of","the","series","in","the","``","dataframes","``","argument",".","future_length","For","target","and","past","dynamic","features","last","``","future_length","``","elements","are","removed","when","iterating","over","the","data","set",".","unchecked","Whether","consistency","checks","on","indexes","should","be","skipped",".","(","Default",":","``","False","``",")","assume_sorted","Whether","to","assume","that","indexes","are","sorted","by","time",",","and","skip","sorting",".","(","Default",":","``","False","``",")"]
code: def __post_init__(self, dataframes, static_features):
      if isinstance(dataframes, dict):
          pairs = dataframes.items()
      elif isinstance(dataframes, (pd.Series, pd.DataFrame)):
          pairs = [(None, dataframes)]
      else:
          assert isinstance(dataframes, SizedIterable)
          pairs = Map(pair_with_item_id, dataframes)
  
      self._data_entries = StarMap(self._pair_to_dataentry, pairs)
  
      if self.freq is None:
          assert (
              self.timestamp is None
          ), "You need to provide `freq` along with `timestamp`"
  
          self.freq = infer_freq(first(pairs)[1].index)
  
      static_features = maybe.unwrap_or_else(
          static_features, pd.DataFrame
      )
  
      object_columns = static_features.select_dtypes(
          "object"
      ).columns.tolist()
      if object_columns:
          logger.warning(
              f"Columns {object_columns} in static_features "
              f"have 'object' as data type and will be ignored; "
              f"consider setting this to 'category' using pd.DataFrame.astype, "
              f"if you wish to use them as categorical columns."
          )
  
      self._static_reals = (
          static_features.select_dtypes("number").astype(self.dtype).T
      )
      self._static_cats = (
          static_features.select_dtypes("category")
          .apply(lambda col: col.cat.codes)
          .astype(self.dtype)
          .T
      )
  
imports: from __future__ import annotations
  import logging
  from dataclasses import dataclass, field, InitVar
  from typing import Any, Iterable, Optional, Type, Union, cast
  import numpy
  import pandas
  from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
  from toolz import first
  from gluonts import maybe
  from gluonts.dataset.common import DataEntry
  from gluonts.itertools import Map, StarMap, SizedIterable
label_desc: Use image node_id 1 for calling the PandasDataset obj's underlying member method code with example usage: obj.__post_init__(dataframes, static_features) without return types