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: Remove rows from the data pack where the length is zero.
  
  :param inplace: `True` to modify inplace, `False` to return a modified
      copy. (default: `False`)
  
  Example:
      >>> import matchzoo as mz
      >>> data_pack = mz.datasets.toy.load_data()
      >>> data_pack.append_text_length(inplace=True, verbose=0)
      >>> data_pack.drop_invalid(inplace=True)
docstr_tok: ["Remove","rows","from","the","data","pack","where","the","length","is","zero",".",":","param","inplace",":","`","True","`","to","modify","inplace",",","`","False","`","to","return","a","modified","copy",".","(","default",":","`","False","`",")","Example",":",">",">",">","import","matchzoo","as","mz",">",">",">","data_pack","=","mz.datasets.toy.load_data","(",")",">",">",">","data_pack.append_text_length","(","inplace=True",",","verbose=0",")",">",">",">","data_pack.drop_invalid","(","inplace=True",")"]
code: def drop_invalid(self):
      """
      Remove rows from the data pack where the length is zero.
  
      :param inplace: `True` to modify inplace, `False` to return a modified
          copy. (default: `False`)
  
      Example:
          >>> import matchzoo as mz
          >>> data_pack = mz.datasets.toy.load_data()
          >>> data_pack.append_text_length(inplace=True, verbose=0)
          >>> data_pack.drop_invalid(inplace=True)
      """
      if not (
          "length_left" in self._left and "length_right" in self._right
      ):
          raise ValueError(
              f"`lenght_left` or `length_right` is missing. "
              f"Please call `append_text_length` in advance."
          )
      valid_left = self._left.loc[self._left.length_left != 0]
      valid_right = self._right.loc[self._right.length_right != 0]
      self._left = self._left[self._left.index.isin(valid_left.index)]
      self._right = self._right[
          self._right.index.isin(valid_right.index)
      ]
      self._relation = self._relation[
          self._relation.id_left.isin(valid_left.index)
          & self._relation.id_right.isin(valid_right.index)
      ]
      self._relation.reset_index(drop=True, inplace=True)
  
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 16 for calling the DataPack obj's underlying member method code with example usage: obj.drop_invalid() without return types