replace.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/types.hpp>
10 #include <cudf/utilities/export.hpp>
12 
13 #include <memory>
14 
20 namespace CUDF_EXPORT cudf {
32 enum class replace_policy : bool { PRECEDING, FOLLOWING };
33 
48 std::unique_ptr<column> replace_nulls(
49  column_view const& input,
50  column_view const& replacement,
53 
67 std::unique_ptr<column> replace_nulls(
68  column_view const& input,
69  scalar const& replacement,
72 
86 std::unique_ptr<column> replace_nulls(
87  column_view const& input,
91 
114 std::unique_ptr<column> replace_nans(
115  column_view const& input,
116  column_view const& replacement,
119 
141 std::unique_ptr<column> replace_nans(
142  column_view const& input,
143  scalar const& replacement,
146 
159 std::unique_ptr<column> find_and_replace_all(
160  column_view const& input_col,
161  column_view const& values_to_replace,
162  column_view const& replacement_values,
165 
212 std::unique_ptr<column> clamp(
213  column_view const& input,
214  scalar const& lo,
215  scalar const& lo_replace,
216  scalar const& hi,
217  scalar const& hi_replace,
220 
260 std::unique_ptr<column> clamp(
261  column_view const& input,
262  scalar const& lo,
263  scalar const& hi,
266 
282 std::unique_ptr<column> normalize_nans_and_zeros(
283  column_view const& input,
286 
301  // end of group
303 } // namespace CUDF_EXPORT cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
A non-owning, mutable view of device data as a column of elements, some of which may be null as indic...
An owning class to represent a singular value.
Definition: scalar.hpp:41
APIs for querying the default CUDA stream and per-thread default stream status.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::resource_ref< cuda::mr::device_accessible > device_async_resource_ref
std::unique_ptr< column > replace_nans(column_view const &input, scalar const &replacement, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Replaces all NaN values in a column with a scalar.
std::unique_ptr< column > replace_nulls(column_view const &input, replace_policy const &replace_policy, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Replaces all null values in a column with the first non-null value that precedes/follows.
std::unique_ptr< column > find_and_replace_all(column_view const &input_col, column_view const &values_to_replace, column_view const &replacement_values, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Return a copy of input_col replacing any values_to_replace[i] found with replacement_values[i].
void normalize_nans_and_zeros(mutable_column_view &in_out, rmm::cuda_stream_view stream=cudf::get_default_stream())
Modifies a column of floating-point elements to replace all -NaN and -0.0 with +NaN and +0....
replace_policy
Policy to specify the position of replacement values relative to null rows.
Definition: replace.hpp:32
std::unique_ptr< column > clamp(column_view const &input, scalar const &lo, scalar const &hi, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Replaces values less than lo in input with lo, and values greater than hi with hi.
APIs for getting and setting the current device memory resource.
cuDF interfaces
Definition: host_udf.hpp:26
Type declarations for libcudf.