|
38 | 38 | pd.MultiIndex.from_arrays(['A B C'.split(), 'D E F'.split()]), |
39 | 39 | ] |
40 | 40 |
|
41 | | -index_sort_groups = [ |
42 | | - # When indexes from the same group are joined, the result is sortable. |
43 | | - # When indexes from different groups are joined, the result is not |
44 | | - # sortable. |
45 | | - |
46 | | - [ # joining produces a string index |
47 | | - pd.Index(['A', 'B', 'C']), |
48 | | - pd.CategoricalIndex('A B C'.split()), |
49 | | - pd.CategoricalIndex('D E F'.split(), ordered=True)], |
50 | | - |
51 | | - [ # numeric indexes |
52 | | - pd.RangeIndex(3), |
53 | | - pd.Int64Index([3, 4, 5]), |
54 | | - pd.UInt64Index([6, 7, 8]), |
55 | | - pd.Float64Index([3.5, 4.5, 5.5]), |
56 | | - pd.Index([9, 10, 11], dtype=object)], |
57 | | - |
58 | | - [pd.to_datetime(['2013-01-01', '2013-01-10', '2013-01-15'])], |
59 | | - [pd.to_timedelta(['1 day', '2 days', '3 days'])], |
60 | | - [pd.PeriodIndex(start='2000', periods=3)], |
61 | | - [pd.interval_range(start=0, end=3)], |
62 | | - [pd.MultiIndex.from_arrays(['A B C'.split(), 'D E F'.split()])], |
63 | | -] |
64 | 41 |
|
65 | 42 | indexes_with_dups = [ |
66 | 43 | # base |
|
92 | 69 | ] |
93 | 70 |
|
94 | 71 |
|
| 72 | +index_sort_groups = [ |
| 73 | + # When indexes from the same group are joined, the result is sortable. |
| 74 | + # When indexes from different groups are joined, the result is not |
| 75 | + # sortable. |
| 76 | + |
| 77 | + [ # joining produces a string index |
| 78 | + pd.Index(['A', 'B', 'C']), |
| 79 | + pd.CategoricalIndex('A B C'.split()), |
| 80 | + pd.CategoricalIndex('D E F'.split(), ordered=True)], |
| 81 | + |
| 82 | + [ # numeric indexes |
| 83 | + pd.RangeIndex(3), |
| 84 | + pd.Int64Index([3, 4, 5]), |
| 85 | + pd.UInt64Index([6, 7, 8]), |
| 86 | + pd.Float64Index([3.5, 4.5, 5.5]), |
| 87 | + pd.Index([9, 10, 11], dtype=object)], |
| 88 | + |
| 89 | + [pd.to_datetime(['2013-01-01', '2013-01-10', '2013-01-15'])], |
| 90 | + [pd.to_timedelta(['1 day', '2 days', '3 days'])], |
| 91 | + [pd.PeriodIndex(start='2000', periods=3)], |
| 92 | + [pd.interval_range(start=0, end=3)], |
| 93 | + [pd.MultiIndex.from_arrays(['A B C'.split(), 'D E F'.split()])], |
| 94 | +] |
| 95 | + |
| 96 | + |
95 | 97 | def cls_name(obj): |
96 | 98 | return obj.__class__.__name__ |
97 | 99 |
|
@@ -275,7 +277,7 @@ def test_bad_input_type(self, sort): |
275 | 277 |
|
276 | 278 | def test_no_unecessary_upcast(self, sort): |
277 | 279 | # GH: 22621 |
278 | | - # When appending, the resulting columns should |
| 280 | + # When appending, the result columns should |
279 | 281 | # not be float64 without necessity. |
280 | 282 |
|
281 | 283 | # basic |
@@ -499,8 +501,7 @@ def test_duplicates_with_sort(self, col_index): |
499 | 501 | df1 = pd.DataFrame([[1, 2, 3]], columns=col_index) |
500 | 502 | df2 = pd.DataFrame([[4, 5, 6]], columns=col_index.copy()) |
501 | 503 | ctx = pytest.raises(InvalidIndexError, |
502 | | - match=r'When sort=True, indexes with duplicate' |
503 | | - ' values are not allowed.') |
| 504 | + match=r'When sort=True, indexes with dupl.*') |
504 | 505 |
|
505 | 506 | with ctx: |
506 | 507 | result = df1.append([], sort=True) |
|
0 commit comments