Files | |
file | datetime.hpp |
DateTime column APIs. | |
Enumerations | |
enum class | cudf::datetime::rounding_frequency : int32_t { DAY , HOUR , MINUTE , SECOND , MILLISECOND , MICROSECOND , NANOSECOND } |
Fixed frequencies supported by datetime rounding functions ceil, floor, round. | |
std::unique_ptr<cudf::column> cudf::datetime::add_calendrical_months | ( | cudf::column_view const & | timestamps, |
cudf::column_view const & | months, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Adds or subtracts a number of months from the datetime type and returns a timestamp column that is of the same type as the input timestamps
column.
For a given row, if the timestamps
or the months
column value is null, the output for that row is null. This method preserves the input time and the day where applicable. The date is rounded down to the last day of the month for that year, if the new day is invalid for that month.
cudf::logic_error | if timestamps datatype is not a TIMESTAMP or if months datatype is not INT16 or INT32. |
cudf::logic_error | if timestamps column size is not equal to months column size. |
timestamps | cudf::column_view of timestamp type |
months | cudf::column_view of integer type containing the number of months to add |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
std::unique_ptr<cudf::column> cudf::datetime::add_calendrical_months | ( | cudf::column_view const & | timestamps, |
cudf::scalar const & | months, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Adds or subtracts a number of months from the datetime type and returns a timestamp column that is of the same type as the input timestamps
column.
For a given row, if the timestamps
value is null, the output for that row is null. A null months scalar would result in an all null column. This method preserves the input time and the day where applicable. The date is rounded down to the last day of the month for that year, if the new day is invalid for that month.
cudf::logic_error | if timestamps datatype is not a TIMESTAMP or if months datatype is not INT16 or INT32. |
cudf::logic_error | if timestamps column size is not equal to months column size. |
timestamps | cudf::column_view of timestamp type |
months | cudf::scalar of integer type containing the number of months to add |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
std::unique_ptr<cudf::column> cudf::datetime::ceil_datetimes | ( | cudf::column_view const & | column, |
rounding_frequency | freq, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Round datetimes up to the nearest multiple of the given frequency.
column | cudf::column_view of the input datetime values |
freq | rounding_frequency indicating the frequency to round up to |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
cudf::logic_error | if input column datatype is not TIMESTAMP. |
std::unique_ptr<cudf::column> cudf::datetime::day_of_year | ( | cudf::column_view const & | column, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Computes the day number since the start of the year from the datetime and returns an int16_t cudf::column. The value is between [1, {365-366}].
column | cudf::column_view of the input datetime values |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
cudf::logic_error | if input column datatype is not a TIMESTAMP |
std::unique_ptr<cudf::column> cudf::datetime::days_in_month | ( | cudf::column_view const & | column, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Extract the number of days in the month.
output[i] contains the number of days in the month of date column[i]
output[i] is null if column[i]
is null
cudf::logic_error | if input column datatype is not a TIMESTAMP |
column | cudf::column_view of the input datetime values |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
std::unique_ptr<cudf::column> cudf::datetime::extract_quarter | ( | cudf::column_view const & | column, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Returns the quarter of the date.
output[i]
will be a value from {1, 2, 3, 4} corresponding to the quarter of month given by column[i]
. It will be null if the input row at column[i]
is null.
cudf::logic_error | if input column datatype is not a TIMESTAMP |
column | The input column containing datetime values |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
std::unique_ptr<cudf::column> cudf::datetime::floor_datetimes | ( | cudf::column_view const & | column, |
rounding_frequency | freq, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Round datetimes down to the nearest multiple of the given frequency.
column | cudf::column_view of the input datetime values |
freq | rounding_frequency indicating the frequency to round down to |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
cudf::logic_error | if input column datatype is not TIMESTAMP. |
std::unique_ptr<cudf::column> cudf::datetime::is_leap_year | ( | cudf::column_view const & | column, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Check if the year of the given date is a leap year.
output[i] == true
if year of column[i]
is a leap year output[i] == false
if year of column[i]
is not a leap year output[i] is null
if column[i]
is null
column | cudf::column_view of the input datetime values |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
cudf::logic_error | if input column datatype is not a TIMESTAMP |
std::unique_ptr<cudf::column> cudf::datetime::last_day_of_month | ( | cudf::column_view const & | column, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Computes the last day of the month in datetime type and returns a TIMESTAMP_DAYS cudf::column.
column | cudf::column_view of the input datetime values |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
cudf::logic_error | if input column datatype is not TIMESTAMP |
std::unique_ptr<cudf::column> cudf::datetime::round_datetimes | ( | cudf::column_view const & | column, |
rounding_frequency | freq, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
Round datetimes to the nearest multiple of the given frequency.
column | cudf::column_view of the input datetime values |
freq | rounding_frequency indicating the frequency to round to |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate device memory of the returned column |
cudf::logic_error | if input column datatype is not TIMESTAMP. |