def append(self, other): """ Append a collection of Index options together Parameters ---------- other : Index or list/tuple of indices Returns ------- appended : Index """ from pandas.core.index import _ensure_compat_concat name = self.name to_concat = [self] if isinstance(other, (list, tuple)): to_concat = to_concat + list(other) else: to_concat.append(other) for obj in to_concat: if isinstance(obj, Index) and obj.name != name: name = None break to_concat = _ensure_compat_concat(to_concat) to_concat = [x.values if isinstance(x, Index) else x for x in to_concat] return Index(com._concat_compat(to_concat), name=name)
def append(self, other): """ Append a collection of Index options together Parameters ---------- other : Index or list/tuple of indices Returns ------- appended : Index """ from pandas.core.index import _ensure_compat_concat name = self.name to_concat = [self] if isinstance(other, (list, tuple)): to_concat = to_concat + list(other) else: to_concat.append(other) for obj in to_concat: if isinstance(obj, Index) and obj.name != name: name = None break to_concat = _ensure_compat_concat(to_concat) to_concat = [ x.values if isinstance(x, Index) else x for x in to_concat ] return Index(com._concat_compat(to_concat), name=name)
def append(self, other): """ Append a collection of Index options together Parameters ---------- other : Index or list/tuple of indices Returns ------- appended : Index """ from pandas.core.index import _ensure_compat_concat name = self.name to_concat = [self] if isinstance(other, (list, tuple)): to_concat = to_concat + list(other) else: to_concat.append(other) for obj in to_concat: if isinstance(obj, Index) and obj.name != name: name = None break to_concat = _ensure_compat_concat(to_concat) to_concat = [ x.values if isinstance(x, Index) else x for x in to_concat ] if all(x.dtype == _NS_DTYPE for x in to_concat): # work around NumPy 1.6 bug new_values = np.concatenate([x.view('i8') for x in to_concat]) return Index(new_values.view(_NS_DTYPE), name=name) else: return Index(np.concatenate(to_concat), name=name)
def append(self, other): """ Append a collection of Index options together Parameters ---------- other : Index or list/tuple of indices Returns ------- appended : Index """ from pandas.core.index import _ensure_compat_concat name = self.name to_concat = [self] if isinstance(other, (list, tuple)): to_concat = to_concat + list(other) else: to_concat.append(other) for obj in to_concat: if isinstance(obj, Index) and obj.name != name: name = None break to_concat = _ensure_compat_concat(to_concat) to_concat = [x.values if isinstance(x, Index) else x for x in to_concat] if all(x.dtype == _NS_DTYPE for x in to_concat): # work around NumPy 1.6 bug new_values = np.concatenate([x.view('i8') for x in to_concat]) return Index(new_values.view(_NS_DTYPE), name=name) else: return Index(np.concatenate(to_concat), name=name)