Skip to content

Commit

Permalink
Merge pull request #8037 from rapidsai/branch-0.19
Browse files Browse the repository at this point in the history
[RELEASE] v0.19.1 cudf
  • Loading branch information
raydouglass authored Apr 22, 2021
2 parents 61e5a20 + bbeb2aa commit a13e8dc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cpp/src/lists/extract.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,7 +63,7 @@ std::unique_ptr<column> extract_list_element(lists_column_view lists_column,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
if (lists_column.is_empty()) return empty_like(lists_column.parent());
if (lists_column.is_empty()) return empty_like(lists_column.child());
auto const offsets_column = lists_column.offsets();

// create a column_view with attributes of the parent and data from the offsets
Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/lists/extract_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION.
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -215,6 +215,7 @@ TEST_F(ListsExtractTest, ExtractElementEmpty)

LCW empty{};
auto result = cudf::lists::extract_list_element(cudf::lists_column_view(empty), 1);
EXPECT_EQ(cudf::data_type{cudf::type_id::STRING}, result->type());
EXPECT_EQ(0, result->size());

LCW empty_strings({LCW{"", "", ""}});
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7953,7 +7953,7 @@ def _setitem_with_dataframe(
"Number of Input Columns must be same replacement Dataframe"
)

if not input_df.index.equals(replace_df.index):
if len(input_df) != 0 and not input_df.index.equals(replace_df.index):
replace_df = replace_df.reindex(input_df.index)

for col_1, col_2 in zip(input_cols, replace_df.columns):
Expand Down
7 changes: 7 additions & 0 deletions python/cudf/cudf/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,13 @@ def test_dataframe_setitem_index_len1():
np.testing.assert_equal(gdf.b.to_array(), [0])


def test_empty_dataframe_setitem_df():
gdf1 = cudf.DataFrame()
gdf2 = cudf.DataFrame({"a": [1, 2, 3, 4, 5]})
gdf1["a"] = gdf2["a"]
assert_eq(gdf1, gdf2)


def test_assign():
gdf = cudf.DataFrame({"x": [1, 2, 3]})
gdf2 = gdf.assign(y=gdf.x + 1)
Expand Down

0 comments on commit a13e8dc

Please sign in to comment.