6
6
import pandas .core .common as com
7
7
from pandas .core .indexes .base import (
8
8
Index ,
9
+ InvalidIndexError ,
9
10
_new_Index ,
10
11
ensure_index ,
11
12
ensure_index_from_sequences ,
12
13
)
13
- from pandas .core .indexes .base import InvalidIndexError # noqa:F401
14
- from pandas .core .indexes .category import CategoricalIndex # noqa:F401
14
+ from pandas .core .indexes .category import CategoricalIndex
15
15
from pandas .core .indexes .datetimes import DatetimeIndex
16
- from pandas .core .indexes .interval import IntervalIndex # noqa:F401
17
- from pandas .core .indexes .multi import MultiIndex # noqa:F401
18
- from pandas .core .indexes .numeric import ( # noqa:F401
16
+ from pandas .core .indexes .interval import IntervalIndex
17
+ from pandas .core .indexes .multi import MultiIndex
18
+ from pandas .core .indexes .numeric import (
19
19
Float64Index ,
20
20
Int64Index ,
21
21
NumericIndex ,
22
22
UInt64Index ,
23
23
)
24
24
from pandas .core .indexes .period import PeriodIndex
25
- from pandas .core .indexes .range import RangeIndex # noqa:F401
25
+ from pandas .core .indexes .range import RangeIndex
26
26
from pandas .core .indexes .timedeltas import TimedeltaIndex
27
27
28
28
_sort_msg = textwrap .dedent (
57
57
"NaT" ,
58
58
"ensure_index" ,
59
59
"ensure_index_from_sequences" ,
60
- "_get_combined_index" ,
61
- "_get_objs_combined_axis" ,
62
- "_union_indexes" ,
63
- "_get_consensus_names" ,
64
- "_all_indexes_same" ,
60
+ "get_objs_combined_axis" ,
61
+ "union_indexes" ,
62
+ "get_consensus_names" ,
63
+ "all_indexes_same" ,
65
64
]
66
65
67
66
68
- def _get_objs_combined_axis (objs , intersect = False , axis = 0 , sort = True ):
67
+ def get_objs_combined_axis (objs , intersect = False , axis = 0 , sort = True ):
69
68
"""
70
69
Extract combined index: return intersection or union (depending on the
71
70
value of "intersect") of indexes on given axis, or None if all objects
@@ -137,7 +136,7 @@ def _get_combined_index(indexes, intersect=False, sort=False):
137
136
for other in indexes [1 :]:
138
137
index = index .intersection (other )
139
138
else :
140
- index = _union_indexes (indexes , sort = sort )
139
+ index = union_indexes (indexes , sort = sort )
141
140
index = ensure_index (index )
142
141
143
142
if sort :
@@ -148,7 +147,7 @@ def _get_combined_index(indexes, intersect=False, sort=False):
148
147
return index
149
148
150
149
151
- def _union_indexes (indexes , sort = True ):
150
+ def union_indexes (indexes , sort = True ):
152
151
"""
153
152
Return the union of indexes.
154
153
@@ -217,7 +216,7 @@ def conv(i):
217
216
218
217
return _unique_indices (indexes )
219
218
220
- name = _get_consensus_names (indexes )[0 ]
219
+ name = get_consensus_names (indexes )[0 ]
221
220
if name != index .name :
222
221
index = index ._shallow_copy (name = name )
223
222
return index
@@ -264,7 +263,7 @@ def _sanitize_and_check(indexes):
264
263
return indexes , "array"
265
264
266
265
267
- def _get_consensus_names (indexes ):
266
+ def get_consensus_names (indexes ):
268
267
"""
269
268
Give a consensus 'names' to indexes.
270
269
@@ -289,7 +288,7 @@ def _get_consensus_names(indexes):
289
288
return [None ] * indexes [0 ].nlevels
290
289
291
290
292
- def _all_indexes_same (indexes ):
291
+ def all_indexes_same (indexes ):
293
292
"""
294
293
Determine if all indexes contain the same elements.
295
294
0 commit comments