Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/branch-24.10' into bug/reductions
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Aug 12, 2024
2 parents f637c7d + 091cb72 commit 2907de9
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 47 deletions.
12 changes: 0 additions & 12 deletions cpp/include/cudf/strings/replace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,6 @@ std::unique_ptr<column> replace_multiple(
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());

/**
* @copydoc cudf::strings::replace_multiple
*
* @deprecated since 24.08
*/
[[deprecated]] std::unique_ptr<column> replace(
strings_column_view const& input,
strings_column_view const& targets,
strings_column_view const& repls,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());

/** @} */ // end of doxygen group
} // namespace strings
} // namespace CUDF_EXPORT cudf
19 changes: 0 additions & 19 deletions cpp/include/cudf/utilities/type_checks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,6 @@

namespace CUDF_EXPORT cudf {

/**
* @brief Compare the types of two `column_view`s
*
* @deprecated Since 24.06. Use cudf::have_same_types instead.
*
* This function returns true if the type of `lhs` equals that of `rhs`.
* - For fixed point types, the scale is compared.
* - For dictionary types, the type of the keys are compared if both are
* non-empty columns.
* - For lists types, the type of child columns are compared recursively.
* - For struct types, the type of each field are compared in order.
* - For all other types, the `id` of `data_type` is compared.
*
* @param lhs The first `column_view` to compare
* @param rhs The second `column_view` to compare
* @return true if column types match
*/
[[deprecated]] bool column_types_equal(column_view const& lhs, column_view const& rhs);

/**
* @brief Compare the type IDs of two `column_view`s
*
Expand Down
11 changes: 0 additions & 11 deletions cpp/src/strings/replace/multi.cu
Original file line number Diff line number Diff line change
Expand Up @@ -533,16 +533,5 @@ std::unique_ptr<column> replace_multiple(strings_column_view const& strings,
return detail::replace_multiple(strings, targets, repls, stream, mr);
}

// deprecated in 24.08
std::unique_ptr<column> replace(strings_column_view const& strings,
strings_column_view const& targets,
strings_column_view const& repls,
rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr)
{
CUDF_FUNC_RANGE();
return detail::replace_multiple(strings, targets, repls, stream, mr);
}

} // namespace strings
} // namespace cudf
5 changes: 0 additions & 5 deletions cpp/src/utilities/type_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ bool have_same_types(column_view const& lhs, column_view const& rhs)
return type_dispatcher(lhs.type(), columns_equal_fn{}, lhs, rhs);
}

bool column_types_equal(column_view const& lhs, column_view const& rhs)
{
return have_same_types(lhs, rhs);
}

bool have_same_types(column_view const& lhs, scalar const& rhs)
{
return type_dispatcher(lhs.type(), column_scalar_equal_fn{}, lhs, rhs);
Expand Down
4 changes: 4 additions & 0 deletions python/cudf/cudf/core/column_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,10 @@ def _select_by_label_list_like(self, key: Any) -> ColumnAccessor:
)
else:
data = {k: self._grouped_data[k] for k in key}
if len(data) != len(key):
raise ValueError(
"Selecting duplicate column labels is not supported."
)
if self.multiindex:
data = dict(_to_flat_dict_inner(data))
return self.__class__(
Expand Down
4 changes: 4 additions & 0 deletions python/cudf/cudf/core/multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,12 +1394,16 @@ def from_arrays(
raise TypeError(error_msg)
codes = []
levels = []
names_from_arrays = []
for array in arrays:
if not (is_list_like(array) or is_column_like(array)):
raise TypeError(error_msg)
code, level = factorize(array, sort=True)
codes.append(code)
levels.append(level)
names_from_arrays.append(getattr(array, "name", None))
if names is None:
names = names_from_arrays
return cls(
codes=codes, levels=levels, sortorder=sortorder, names=names
)
Expand Down
8 changes: 8 additions & 0 deletions python/cudf/cudf/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2361,3 +2361,11 @@ def test_sliced_categorical_as_ordered():
name="a",
)
assert_eq(result, expected)


def test_duplicate_labels_raises():
df = cudf.DataFrame([[1, 2]], columns=["a", "b"])
with pytest.raises(ValueError):
df[["a", "a"]]
with pytest.raises(ValueError):
df.loc[:, ["a", "a"]]
10 changes: 10 additions & 0 deletions python/cudf/cudf/tests/test_multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2179,3 +2179,13 @@ def test_unique_level():
result = pd_mi.unique(level=1)
expected = cudf_mi.unique(level=1)
assert_eq(result, expected)


@pytest.mark.parametrize(
"idx", [pd.Index, pd.CategoricalIndex, pd.DatetimeIndex, pd.TimedeltaIndex]
)
def test_from_arrays_infer_names(idx):
arrays = [idx([1], name="foo"), idx([2], name="bar")]
expected = pd.MultiIndex.from_arrays(arrays)
result = cudf.MultiIndex.from_arrays(arrays)
assert_eq(result, expected)

0 comments on commit 2907de9

Please sign in to comment.