cudf/replace.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/types.hpp>
21 #include <cudf/utilities/export.hpp>
22 
24 #include <rmm/resource_ref.hpp>
25 
26 #include <memory>
27 
28 namespace CUDF_EXPORT cudf {
41 enum class replace_policy : bool { PRECEDING, FOLLOWING };
42 
57 std::unique_ptr<column> replace_nulls(
58  column_view const& input,
59  column_view const& replacement,
62 
76 std::unique_ptr<column> replace_nulls(
77  column_view const& input,
78  scalar const& replacement,
81 
95 std::unique_ptr<column> replace_nulls(
96  column_view const& input,
100 
123 std::unique_ptr<column> replace_nans(
124  column_view const& input,
125  column_view const& replacement,
128 
150 std::unique_ptr<column> replace_nans(
151  column_view const& input,
152  scalar const& replacement,
155 
168 std::unique_ptr<column> find_and_replace_all(
169  column_view const& input_col,
170  column_view const& values_to_replace,
171  column_view const& replacement_values,
174 
221 std::unique_ptr<column> clamp(
222  column_view const& input,
223  scalar const& lo,
224  scalar const& lo_replace,
225  scalar const& hi,
226  scalar const& hi_replace,
229 
269 std::unique_ptr<column> clamp(
270  column_view const& input,
271  scalar const& lo,
272  scalar const& hi,
275 
291 std::unique_ptr<column> normalize_nans_and_zeros(
292  column_view const& input,
295 
310  // end of group
312 } // 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:49
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
device_memory_resource * get_current_device_resource()
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=rmm::mr::get_current_device_resource())
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=rmm::mr::get_current_device_resource())
Replaces all null values in a column with the first non-null value that precedes/follows.
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.
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=rmm::mr::get_current_device_resource())
Replaces values less than lo in input with lo, and values greater than hi with hi.
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=rmm::mr::get_current_device_resource())
Return a copy of input_col replacing any values_to_replace[i] found with replacement_values[i].
cuDF interfaces
Definition: aggregation.hpp:35
Type declarations for libcudf.