docstr: Force time frame to have length ``length``.
  
  This pads or slices the time frame, depending on whether its size is
  smaller or bigger than the required length.
  
  By default we pad values on the left, and skip on the right.
docstr_tok: ["Force","time","frame","to","have","length","``","length","``",".","This","pads","or","slices","the","time","frame",",","depending","on","whether","its","size","is","smaller","or","bigger","than","the","required","length",".","By","default","we","pad","values","on","the","left",",","and","skip","on","the","right","."]
code: def resize(
      self,
      length: Optional[int],
      pad_value=0,
      pad: LeftOrRight = "l",
      skip: LeftOrRight = "r",
  ) -> TimeBase:
      """Force time frame to have length ``length``.
  
      This pads or slices the time frame, depending on whether its size is
      smaller or bigger than the required length.
  
      By default we pad values on the left, and skip on the right.
      """
      assert pad in ("l", "r")
      assert skip in ("l", "r")
  
      if length is None or len(self) == length:
          return self
  
      if len(self) < length:
          left = right = 0
          if pad == "l":
              left = length - len(self)
          else:
              right = length - len(self)
  
          return self.pad(pad_value, left=left, right=right)
  
      if skip == "l":
          return self.iloc[len(self) - length :]
      else:
          return self.iloc[: length - len(self)]
  
imports: from __future__ import annotations
  import dataclasses
  from typing import Any, Optional, NamedTuple, Union
  from typing_extensions import Literal
  from gluonts import maybe
  from ._period import Periods, Period
  from ._util import _replace
label_desc: Use image node_id 10 for calling the TimeBase obj's underlying member method code with example usage: obj.resize(length, pad_value, pad, skip) and returns: self, self, self, self