rstoolbox.utils.split_dataframe_rows

rstoolbox.utils.split_dataframe_rows(df, column_selectors, row_delimiter=None)

Given a dataframe in which certain columns are lists, it splits these lists making new rows in the DataFrame out of itself.

When multiple columns have lists of similar lengths, it assumes that same index positions on the list go in the same new row.

Parameters:
  • df (DataFrame) – Input data.
  • column_selectors (list() of str) – List of columns containg same-sized lists.
  • row_delimiter (str) – If provided, instead of list, it assumes data are strings and uses the delimiter to make those strings into lists.