Skip to content

Commit 7a5918a

Browse files
committed
REF: replaced two more instances of _get_combined_index
1 parent d339131 commit 7a5918a

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

Diff for: pandas/core/panel.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from pandas.core.frame import DataFrame
2727
from pandas.core.generic import NDFrame, _shared_docs
2828
from pandas.core.index import (Index, MultiIndex, _ensure_index,
29-
_get_combined_index)
29+
_get_objs_combined_axis)
3030
from pandas.io.formats.printing import pprint_thing
3131
from pandas.core.indexing import maybe_droplevels
3232
from pandas.core.internals import (BlockManager,
@@ -1448,21 +1448,20 @@ def _extract_axis(self, data, axis=0, intersect=False):
14481448
index = Index([])
14491449
elif len(data) > 0:
14501450
raw_lengths = []
1451-
indexes = []
14521451

14531452
have_raw_arrays = False
14541453
have_frames = False
14551454

14561455
for v in data.values():
14571456
if isinstance(v, self._constructor_sliced):
14581457
have_frames = True
1459-
indexes.append(v._get_axis(axis))
14601458
elif v is not None:
14611459
have_raw_arrays = True
14621460
raw_lengths.append(v.shape[axis])
14631461

14641462
if have_frames:
1465-
index = _get_combined_index(indexes, intersect=intersect)
1463+
index = _get_objs_combined_axis(data.values(), axis=axis,
1464+
intersect=intersect)
14661465

14671466
if have_raw_arrays:
14681467
lengths = list(set(raw_lengths))

Diff for: pandas/core/reshape/concat.py

+8-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import numpy as np
66
from pandas import compat, DataFrame, Series, Index, MultiIndex
7-
from pandas.core.index import (_get_combined_index,
7+
from pandas.core.index import (_get_objs_combined_axis,
88
_ensure_index, _get_consensus_names,
99
_all_indexes_same)
1010
from pandas.core.categorical import (_factorize_from_iterable,
@@ -445,16 +445,13 @@ def _get_new_axes(self):
445445
return new_axes
446446

447447
def _get_comb_axis(self, i):
448-
if self._is_series:
449-
all_indexes = [x.index for x in self.objs]
450-
else:
451-
try:
452-
all_indexes = [x._data.axes[i] for x in self.objs]
453-
except IndexError:
454-
types = [type(x).__name__ for x in self.objs]
455-
raise TypeError("Cannot concatenate list of %s" % types)
456-
457-
return _get_combined_index(all_indexes, intersect=self.intersect)
448+
data_axis = self.objs[0]._get_block_manager_axis(i)
449+
try:
450+
return _get_objs_combined_axis(self.objs, axis=data_axis,
451+
intersect=self.intersect)
452+
except IndexError:
453+
types = [type(x).__name__ for x in self.objs]
454+
raise TypeError("Cannot concatenate list of %s" % types)
458455

459456
def _get_concat_axis(self):
460457
"""

0 commit comments

Comments
 (0)