docstr: Returns a PandasPdb object with the same data as the PandasMmcif
  object.
  
  Attributes
  ----------
  offset_chains: bool
      Whether or not to offset atom numbering based on number of chains.
      This can arise due to the presence of TER records in PDBs which are
      not found in mmCIFs.
  records: List[str]
      List of record types to save. Any of ["ATOM", "HETATM", "OTHERS"].
      Defaults to ["ATOM", "HETATM"].
docstr_tok: ["Returns","a","PandasPdb","object","with","the","same","data","as","the","PandasMmcif","object",".","Attributes","--","--","--","--","--","offset_chains",":","bool","Whether","or","not","to","offset","atom","numbering","based","on","number","of","chains",".","This","can","arise","due","to","the","presence","of","TER","records","in","PDBs","which","are","not","found","in","mmCIFs",".","records",":","List","[","str","]","List","of","record","types","to","save",".","Any","of","[","``","ATOM","''",",","``","HETATM","''",",","``","OTHERS","''","]",".","Defaults","to","[","``","ATOM","''",",","``","HETATM","''","]","."]
code: def convert_to_pandas_pdb(
      self,
      offset_chains: bool = True,
      records: List[str] = ["ATOM", "HETATM"],
  ) -> PandasPdb:
      """Returns a PandasPdb object with the same data as the PandasMmcif
      object.
  
      Attributes
      ----------
      offset_chains: bool
          Whether or not to offset atom numbering based on number of chains.
          This can arise due to the presence of TER records in PDBs which are
          not found in mmCIFs.
      records: List[str]
          List of record types to save. Any of ["ATOM", "HETATM", "OTHERS"].
          Defaults to ["ATOM", "HETATM"].
  
      """
      pandaspdb = PandasPdb()
  
      for a in records:
          try:
              dfa = self.df[a]
              # keep only those fields found in pdb
              dfa = dfa[MMCIF_PDB_COLUMN_MAP.keys()]
              # rename fields
              dfa = dfa.rename(columns=MMCIF_PDB_COLUMN_MAP)
              # add empty fields
              for i in MMCIF_PDB_NONEFIELDS:
                  dfa[i] = ""
              dfa["charge"] = np.nan
              # reorder columns to PandasPdb order
              dfa = dfa[PDB_COLUMN_ORDER]
              pandaspdb.df[a] = dfa
          except KeyError:  # Some entries may not have an ANISOU
              continue
  
      # update line_idx
      pandaspdb.df["ATOM"]["line_idx"] = pandaspdb.df[
          "ATOM"
      ].index.values
      pandaspdb.df["HETATM"]["line_idx"] = pandaspdb.df["HETATM"].index
  
      # Update atom numbers
      if offset_chains:
          offsets = (
              pandaspdb.df["ATOM"]["chain_id"]
              .astype("category")
              .cat.codes
          )
          pandaspdb.df["ATOM"]["atom_number"] = (
              pandaspdb.df["ATOM"]["atom_number"] + offsets
          )
          hetatom_offset = offsets.max() + 1
          pandaspdb.df["HETATM"]["atom_number"] = (
              pandaspdb.df["HETATM"]["atom_number"] + hetatom_offset
          )
  
      return pandaspdb
  
imports: import gzip
  import sys
  import warnings
  from typing import Dict, List, Optional
  from urllib.error import HTTPError, URLError
  from urllib.request import urlopen
  import numpy
  import pandas
  from looseversion import LooseVersion
  from ..pdb.engines import amino3to1dict
  from ..pdb.pandas_pdb import PandasPdb
  from .engines import ANISOU_DF_COLUMNS, MMCIF_PDB_COLUMN_MAP, MMCIF_PDB_NONEFIELDS, PDB_COLUMN_ORDER, mmcif_col_types
  from .mmcif_parser import load_cif_data
label_desc: Use image node_id 22 for calling the PandasMmcif obj's underlying member method code with example usage: obj.convert_to_pandas_pdb(offset_chains, records) and returns: pandaspdb