class_docstr: Matchzoo :class:`DataPack` data structure, store dataframe and context.
  
  `DataPack` is a MatchZoo native data structure that most MatchZoo data
  handling processes build upon. A `DataPack` consists of three parts:
  `left`, `right` and `relation`, each one of is a `pandas.DataFrame`.
  
  :param relation: Store the relation between left document
      and right document use ids.
  :param left: Store the content or features for id_left.
  :param right: Store the content or features for
      id_right.
  
  Example:
      >>> left = [
      ...     ['qid1', 'query 1'],
      ...     ['qid2', 'query 2']
      ... ]
      >>> right = [
      ...     ['did1', 'document 1'],
      ...     ['did2', 'document 2']
      ... ]
      >>> relation = [['qid1', 'did1', 1], ['qid2', 'did2', 1]]
      >>> relation_df = pd.DataFrame(relation)
      >>> left = pd.DataFrame(left)
      >>> right = pd.DataFrame(right)
      >>> dp = DataPack(
      ...     relation=relation_df,
      ...     left=left,
      ...     right=right,
      ... )
      >>> len(dp)
      2
class_docstr_tok: ["Matchzoo",":","class",":","`","DataPack","`","data","structure",",","store","dataframe","and","context",".","`","DataPack","`","is","a","MatchZoo","native","data","structure","that","most","MatchZoo","data","handling","processes","build","upon",".","A","`","DataPack","`","consists","of","three","parts",":","`","left","`",",","`","right","`","and","`","relation","`",",","each","one","of","is","a","`","pandas.DataFrame","`",".",":","param","relation",":","Store","the","relation","between","left","document","and","right","document","use","ids",".",":","param","left",":","Store","the","content","or","features","for","id_left",".",":","param","right",":","Store","the","content","or","features","for","id_right",".","Example",":",">",">",">","left","=","[","...","[","'qid1","'",",","'query","1","'","]",",","...","[","'qid2","'",",","'query","2","'","]","...","]",">",">",">","right","=","[","...","[","'did1","'",",","'document","1","'","]",",","...","[","'did2","'",",","'document","2","'","]","...","]",">",">",">","relation","=","[","[","'qid1","'",",","'did1","'",",","1","]",",","[","'qid2","'",",","'did2","'",",","1","]","]",">",">",">","relation_df","=","pd.DataFrame","(","relation",")",">",">",">","left","=","pd.DataFrame","(","left",")",">",">",">","right","=","pd.DataFrame","(","right",")",">",">",">","dp","=","DataPack","(","...","relation=relation_df",",","...","left=left",",","...","right=right",",","...",")",">",">",">","len","(","dp",")","2"]
docstr: Save the :class:`DataPack` object.
  
  A saved :class:`DataPack` is represented as a directory with a
  :class:`DataPack` object (transformed user input as features and
  context), it will be saved by `pickle`.
  
  :param dirpath: directory path of the saved :class:`DataPack`.
docstr_tok: ["Save","the",":","class",":","`","DataPack","`","object",".","A","saved",":","class",":","`","DataPack","`","is","represented","as","a","directory","with","a",":","class",":","`","DataPack","`","object","(","transformed","user","input","as","features","and","context",")",",","it","will","be","saved","by","`","pickle","`",".",":","param","dirpath",":","directory","path","of","the","saved",":","class",":","`","DataPack","`","."]
code: def save(self, dirpath: typing.Union[str, Path]):
      """
      Save the :class:`DataPack` object.
  
      A saved :class:`DataPack` is represented as a directory with a
      :class:`DataPack` object (transformed user input as features and
      context), it will be saved by `pickle`.
  
      :param dirpath: directory path of the saved :class:`DataPack`.
      """
      dirpath = Path(dirpath)
      data_file_path = dirpath.joinpath(self.DATA_FILENAME)
  
      if data_file_path.exists():
          raise FileExistsError(
              f"{data_file_path} already exist, fail to save"
          )
      elif not dirpath.exists():
          dirpath.mkdir()
  
      dill.dump(self, open(data_file_path, mode="wb"))
  
imports: import typing
  import inspect
  from pathlib import Path
  import functools
  import dill
  from tqdm import tqdm
  import numpy
  import pandas
  import matchzoo
label_desc: Use image node_id 12 for calling the DataPack obj's underlying member method code with example usage: obj.save(dirpath) without return types