Pandas

value_counts_df(df_in, col_in)[source]

Returns pd.value_counts() as a DataFrame

Parameters:
  • df_in – Dataframe on which to run value_counts(), must have column col.

  • col_in – Name of column in df for which to generate counts

Returns:

Returned dataframe will have two columns, one named “count” which contains the count_values() for each unique value of df[col]. The other column will be named col.

add_molecule_and_errors(df_in, smiles_col='SMILES', mol_col_name='ROMol', error_col_name='Error')[source]

Add a molecule column and another column with associated errors to a Pandas dataframe

Parameters:
  • df_in – input dataframe

  • smiles_col – name for the input SMILES column

  • mol_col_name – name for the output molecule column

  • error_col_name – name for the output errors column

Returns:

None

split_dataframe(df, chunk_size=10000)[source]

Split a dataframe into chunks of at most chunk_size rows

Parameters:
  • df – dataframe to split

  • chunk_size – maximum number of rows per chunk

Returns:

list of dataframes, none of them empty