Skip to content

Commit

Permalink
REF: replaced two more instances of _get_combined_index
Browse files Browse the repository at this point in the history
  • Loading branch information
toobaz committed Aug 11, 2017
1 parent 29be61e commit 37c3879
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pandas.core.frame import DataFrame
from pandas.core.generic import NDFrame, _shared_docs
from pandas.core.index import (Index, MultiIndex, _ensure_index,
_get_combined_index)
_get_objs_combined_axis)
from pandas.io.formats.printing import pprint_thing
from pandas.core.indexing import maybe_droplevels
from pandas.core.internals import (BlockManager,
Expand Down Expand Up @@ -1448,21 +1448,21 @@ def _extract_axis(self, data, axis=0, intersect=False):
index = Index([])
elif len(data) > 0:
raw_lengths = []
indexes = []

have_raw_arrays = False
have_frames = False

for v in data.values():
if isinstance(v, self._constructor_sliced):
have_frames = True
indexes.append(v._get_axis(axis))
elif v is not None:
have_raw_arrays = True
raw_lengths.append(v.shape[axis])

if have_frames:
index = _get_combined_index(indexes, intersect=intersect)
index = _get_objs_combined_axis(data.values(), axis=axis,
intersect=intersect)


if have_raw_arrays:
lengths = list(set(raw_lengths))
Expand Down
19 changes: 8 additions & 11 deletions pandas/core/reshape/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
from pandas import compat, DataFrame, Series, Index, MultiIndex
from pandas.core.index import (_get_combined_index,
from pandas.core.index import (_get_objs_combined_axis,
_ensure_index, _get_consensus_names,
_all_indexes_same)
from pandas.core.categorical import (_factorize_from_iterable,
Expand Down Expand Up @@ -445,16 +445,13 @@ def _get_new_axes(self):
return new_axes

def _get_comb_axis(self, i):
if self._is_series:
all_indexes = [x.index for x in self.objs]
else:
try:
all_indexes = [x._data.axes[i] for x in self.objs]
except IndexError:
types = [type(x).__name__ for x in self.objs]
raise TypeError("Cannot concatenate list of %s" % types)

return _get_combined_index(all_indexes, intersect=self.intersect)
data_axis = 1 - i if self.objs[0].ndim == 2 else i
try:
return _get_objs_combined_axis(self.objs, axis=data_axis,
intersect=self.intersect)
except IndexError:
types = [type(x).__name__ for x in self.objs]
raise TypeError("Cannot concatenate list of %s" % types)

def _get_concat_axis(self):
"""
Expand Down

0 comments on commit 37c3879

Please sign in to comment.