dispel.processing.utils module#

Utility functions around data processing.

class dispel.processing.utils.TaskMixin[source]#

Bases: object

A mixin class for entities related to tasks.

get_task_name(**kwargs)[source]#

Get the task name.

Return type:

str | AbbreviatedValue

task_name: AbbreviatedValue | str#

The task name

dispel.processing.utils.parallel_explode(data, dtype='float64')[source]#

Transform each element of a list-like to a row for all columns.

Parameters:
  • data (DataFrame) – The data pandas data frame to be exploded.

  • dtype – The type of the data frame values.

Returns:

Exploded lists to rows of all columns.

Return type:

pandas.DataFrame

Examples

parallel_explode

>>> df = pd.DataFrame({
...        'a': [[2.], [3., 4.], [], [6., 7.]],
...        'b': [[8.], [9., 10.], [11.], [12., 13.]],
...    })
>>> df
            a             b
0       [2.0]         [8.0]
1  [3.0, 4.0]   [9.0, 10.0]
2          []        [11.0]
3  [6.0, 7.0]  [12.0, 13.0]
>>> parallel_explode(df)
     a     b
0  2.0   8.0
1  3.0   9.0
2  4.0  10.0
3  6.0  11.0
4  7.0  12.0
5  NaN  13.0