Skip to content

Commit

Permalink
Merge pull request #5879 from madsbk/concat_sub_types
Browse files Browse the repository at this point in the history
[REVIEW] concat(): support sub-types and object wrappers
  • Loading branch information
kkraus14 authored Aug 11, 2020
2 parents 228d6ca + 53ed07c commit b773c9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
- PR #5853 Disable `fixed_point` for use in `copy_if`
- PR #5854 Raise informative error in `DataFrame.iterrows` and `DataFrame.itertuples`
- PR #5863 Explicitly require `ucx-py` on CI
- PR #5879 Added support of sub-types and object wrappers in concat()
- PR #5884 Use S3 bucket directly for benchmark plugni
- PR #5881 Add in JVM extractListElement and stringSplitRecord
- PR #5885 Add in java support for merge sort
Expand Down
17 changes: 16 additions & 1 deletion python/cudf/cudf/core/reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,22 @@ def concat(objs, axis=0, ignore_index=False, sort=None):
if len(objs) == 0:
raise ValueError("All objects passed were None")

typs = set(type(o) for o in objs)
# Retrieve the base types of `objs`. In order to support sub-types
# and object wrappers, we use `isinstance()` instead of comparing
# types directly
typs = set()
for o in objs:
if isinstance(o, cudf.MultiIndex):
typs.add(cudf.MultiIndex)
if issubclass(type(o), Index):
typs.add(type(o))
elif isinstance(o, DataFrame):
typs.add(DataFrame)
elif isinstance(o, Series):
typs.add(Series)
else:
raise ValueError(f"cannot concatenate object of type {type(o)}")

allowed_typs = {Series, DataFrame}

param_axis = _axis_map.get(axis, None)
Expand Down

0 comments on commit b773c9e

Please sign in to comment.