def test_convert_to_ordered_category_base_category(): values = pd.Series(['a', 'a', 'b', 'b', 'b', 'c', 'c', 'd']) cat_values = convert_to_ordered_category(values, 'a') eq_(cat_values.cat.categories[0], 'a')
def test_convert_to_ordered_category_wrong_base_category(): values = pd.Series(['a', 'a', 'b', 'b', 'b', 'c', 'c', 'd']) convert_to_ordered_category(values, 'e')
def test_convert_to_ordered_category_several_maximums(): values = pd.Series( ['a_2', 'a_3', 'a_1', 'a_2', 'a_3', 'a_1', 'a_2', 'a_3', 'a_1']) cat_values = convert_to_ordered_category(values) eq_(cat_values.cat.categories[0], 'a_1')