code: def smiles2mol(
      df: pd.DataFrame,
      smiles_column_name: Hashable,
      mols_column_name: Hashable,
      drop_nulls: bool = True,
      progressbar: Optional[str] = None,
  ) -> pd.DataFrame:
      """Convert a column of SMILES strings into RDKit Mol objects.
  
      Automatically drops invalid SMILES, as determined by RDKIT.
  
      This method mutates the original DataFrame.
  
      Examples:
          Functional usage
  
          >>> import pandas as pd
          >>> import janitor.chemistry
          >>> df = pd.DataFrame({"smiles": ["O=C=O", "CCC(=O)O"]})
          >>> df = janitor.chemistry.smiles2mol(
          ...    df=df,
          ...    smiles_column_name='smiles',
          ...    mols_column_name='mols'
          ... )
          >>> df.mols[0].GetNumAtoms(), df.mols[0].GetNumBonds()
          (3, 2)
          >>> df.mols[1].GetNumAtoms(), df.mols[1].GetNumBonds()
          (5, 4)
  
          Method chaining usage
  
          >>> import pandas as pd
          >>> import janitor.chemistry
          >>> df = df.smiles2mol(
          ...     smiles_column_name='smiles',
          ...     mols_column_name='rdkmol'
          ... )
          >>> df.rdkmol[0].GetNumAtoms(), df.rdkmol[0].GetNumBonds()
          (3, 2)
  
      A progressbar can be optionally used.
  
      - Pass in "notebook" to show a `tqdm` notebook progressbar.
        (`ipywidgets` must be enabled with your Jupyter installation.)
      - Pass in "terminal" to show a `tqdm` progressbar. Better suited for use
        with scripts.
      - `None` is the default value - progress bar will not be shown.
  
      Args:
          df: pandas DataFrame.
          smiles_column_name: Name of column that holds the SMILES strings.
          mols_column_name: Name to be given to the new mols column.
          drop_nulls: Whether to drop rows whose mols failed to be
              constructed.
          progressbar: Whether to show a progressbar or not.
  
      Raises:
          ValueError: If `progressbar` is not one of
              `"notebook"`, `"terminal"`, or `None`.
  
      Returns:
          A pandas DataFrame with new RDKIT Mol objects column.
      """
      valid_progress = ["notebook", "terminal", None]
      if progressbar not in valid_progress:
          raise ValueError(
              f"progressbar kwarg must be one of {valid_progress}"
          )
  
      if progressbar is None:
          df[mols_column_name] = df[smiles_column_name].apply(
              lambda x: Chem.MolFromSmiles(x)
          )
      else:
          if progressbar == "notebook":
              tqdmn().pandas(desc="mols")
          elif progressbar == "terminal":
              tqdm.pandas(desc="mols")
          df[mols_column_name] = df[smiles_column_name].progress_apply(
              lambda x: Chem.MolFromSmiles(x)
          )
  
      if drop_nulls:
          df = df.dropna(subset=[mols_column_name])
      df = df.reset_index(drop=True)
      return df
  
file_path: pyjanitor/janitor/chemistry.py
imports: from typing import Hashable, Literal, Optional
  import numpy
  import pandas
  import pandas_flavor
  from .utils import deprecated_alias, import_message
label_desc: Use image node_id 1 for calling a global function with example usage: smiles2mol(df, smiles_column_name, mols_column_name, drop_nulls, progressbar) and returns: df