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 
22 #include <rmm/mr/device/per_device_resource.hpp>
23 #include <rmm/resource_ref.hpp>
24 
25 #include <memory>
26 
27 namespace cudf {
40 enum class replace_policy : bool { PRECEDING, FOLLOWING };
41 
56 std::unique_ptr<column> replace_nulls(
57  column_view const& input,
58  column_view const& replacement,
59  rmm::cuda_stream_view stream = cudf::get_default_stream(),
60  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
61 
75 std::unique_ptr<column> replace_nulls(
76  column_view const& input,
77  scalar const& replacement,
78  rmm::cuda_stream_view stream = cudf::get_default_stream(),
79  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
80 
94 std::unique_ptr<column> replace_nulls(
95  column_view const& input,
97  rmm::cuda_stream_view stream = cudf::get_default_stream(),
98  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
99 
122 std::unique_ptr<column> replace_nans(
123  column_view const& input,
124  column_view const& replacement,
125  rmm::cuda_stream_view stream = cudf::get_default_stream(),
126  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
127 
149 std::unique_ptr<column> replace_nans(
150  column_view const& input,
151  scalar const& replacement,
152  rmm::cuda_stream_view stream = cudf::get_default_stream(),
153  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
154 
167 std::unique_ptr<column> find_and_replace_all(
168  column_view const& input_col,
169  column_view const& values_to_replace,
170  column_view const& replacement_values,
171  rmm::cuda_stream_view stream = cudf::get_default_stream(),
172  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
173 
220 std::unique_ptr<column> clamp(
221  column_view const& input,
222  scalar const& lo,
223  scalar const& lo_replace,
224  scalar const& hi,
225  scalar const& hi_replace,
226  rmm::cuda_stream_view stream = cudf::get_default_stream(),
227  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
228 
268 std::unique_ptr<column> clamp(
269  column_view const& input,
270  scalar const& lo,
271  scalar const& hi,
272  rmm::cuda_stream_view stream = cudf::get_default_stream(),
273  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
274 
290 std::unique_ptr<column> normalize_nans_and_zeros(
291  column_view const& input,
292  rmm::cuda_stream_view stream = cudf::get_default_stream(),
293  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
294 
308  rmm::cuda_stream_view stream = cudf::get_default_stream());
309  // end of group
311 } // namespace 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.
std::unique_ptr< column > clamp(column_view const &input, scalar const &lo, scalar const &lo_replace, scalar const &hi, scalar const &hi_replace, 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_replace, and values greater than hi with hi_replace.
replace_policy
Policy to specify the position of replacement values relative to null rows.
std::unique_ptr< column > replace_nans(column_view const &input, column_view 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 corresponding values from another column.
std::unique_ptr< column > normalize_nans_and_zeros(column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Copies from a column of floating-point elements and replaces -NaN and -0.0 with +NaN and +0....
std::unique_ptr< column > replace_nulls(column_view const &input, column_view 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 null values in a column with corresponding values of another column.
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:34
Type declarations for libcudf.