toad.preprocessing.process module¶
-
class
toad.preprocessing.process.
Processing
(data)[source]¶ Bases:
object
Example:
>>> (Processing(data) ... .groupby('id') ... .partitionby(TimePartition( ... 'base_time', ... 'filter_time', ... ['30d', '60d', '180d', '365d', 'all'] ... )) ... .apply({'A': ['max', 'min', 'mean']}) ... .apply({'B': ['max', 'min', 'mean']}) ... .apply({'C': 'nunique'}) ... .apply({'D': { ... 'f': len, ... 'name': 'normal_count', ... 'mask': Mask('D').isin(['normal']), ... }}) ... .apply({'id': 'count'}) ... .exec() ... )
-
apply
(f)[source]¶ apply functions to data
Parameters: f (dict|function) – a config dict that keys are the column names and values are the functions, it will take the column series as the functions argument. if f is a function, it will take the whole dataframe as the argument.
-