sort_operator

Sort multiple dataframes based on some keys

class tasrif.processing_pipeline.pandas.sort_operator.SortOperator(**kwargs)

Sort datasets based on Pandas sort_values method.

Examples

>>> df1 = pd.DataFrame({'id': [1, 2, 3], 'colors': ['red', 'white', 'blue'], "importance": [1, 3, 2]})
>>> df2 = pd.DataFrame({'id': [1, 2, 3], 'cities': ['Doha', 'Vienna', 'Belo Horizonte'], "importance": [3, 2, 1]})
>>> sorted_dfs = SortOperator().process(df1, df2)
>>> sorted_dfs[0]
id  colors  importance
1       red     1
3       blue        2
2       white       3
>>> sorted_dfs[1]
id  cities          importance
3       Belo Horizonte      1
2       Vienna              2
1       Doha                3
__init__(**kwargs)

Sort datasets using the Pandas function sort_values.

Parameters

**kwargs – keyword arguments passed to pandas DataFrame.sort_values method