cyto_dl.dataframe.transforms.misc module#

cyto_dl.dataframe.transforms.misc.append_class_weights(dataframe: DataFrame, column: str)[source]#

Add class weights (based on column) to a dataframe.

Parameters:
  • dataframe (pd.DataFrame) – Input dataframe

  • column (str) – Column to base the weights on

cyto_dl.dataframe.transforms.misc.append_labels_to_integers(dataframe: DataFrame, column: str)[source]#

Modifies its argument by appending the integer-encoded values of column into the given dataframe.

Parameters:
  • dataframe (pd.DataFrame) – Input dataframe

  • column (str) – Column to convert into one hot encoding

cyto_dl.dataframe.transforms.misc.append_one_hot(dataframe: DataFrame, column: str)[source]#

Modifies its argument by appending the one hot encoding columns into the given dataframe. Calls function one_hot_encoding.

Parameters:
  • dataframe (pd.DataFrame) – Input dataframe

  • column (str) – Column to convert into one hot encoding

cyto_dl.dataframe.transforms.misc.make_random_df(columns: Sequence[str] = ['A', 'B', 'C', 'D'], n_rows: int = 100)[source]#

Generate a random dataframe. Useful to test data wrangling pipelines.

Parameters:
  • columns (Sequence[str] = [“A”,”B”,”C”,”D”]) – List of columns to add to the random dataframe. If none are provided, a dataframe with columns [“A”,”B”,”C”,”D”] is created

  • n_rows (int = 100) – Number of rows to create for the random dataframe