def _get_combined_index(indexes, intersect=False): # TODO: handle index names! indexes = com._get_distinct_objs(indexes) if len(indexes) == 0: return Index([]) if len(indexes) == 1: return indexes[0] if intersect: index = indexes[0] for other in indexes[1:]: index = index.intersection(other) return index union = _union_indexes(indexes) return _ensure_index(union)
def _get_combined_index(indexes, intersect=False, sort=False): # TODO: handle index names! indexes = com._get_distinct_objs(indexes) if len(indexes) == 0: index = Index([]) elif len(indexes) == 1: index = indexes[0] elif intersect: index = indexes[0] for other in indexes[1:]: index = index.intersection(other) else: index = _union_indexes(indexes, sort=sort) index = _ensure_index(index) if sort: try: index = index.sort_values() except TypeError: pass return index