toad.preprocessing.partition module

class toad.preprocessing.partition.TimePartition(base, filter, times)[source]

Bases: toad.preprocessing.partition.Partition

partition data by time delta

Parameters:
  • base (str) – column name of base time
  • filter (str) – column name of target time to be compared
  • times (list) – list of time delta`

Example:

>>> TimePartition('apply_time', 'query_time', ['30d', '90d', 'all'])
__init__(base, filter, times)[source]

Initialize self. See help(type(self)) for accurate signature.

partition(data)[source]

partition data

Parameters:data (DataFrame) – dataframe
Returns:mask of partition data iterator -> str: suffix string of current partition
Return type:iterator -> ndarray[bool]
class toad.preprocessing.partition.ValuePartition(column)[source]

Bases: toad.preprocessing.partition.Partition

partition data by column values

Parameters:column (str) – column name which will be used as partition

Example:

>>> ValuePartition('status')
__init__(column)[source]

Initialize self. See help(type(self)) for accurate signature.

partition(data)[source]

partition data

Parameters:data (DataFrame) – dataframe
Returns:mask of partition data iterator -> str: suffix string of current partition
Return type:iterator -> ndarray[bool]