series_floor function rounds down each element in a numeric dynamic array (series) to the nearest integer that’s less than or equal to the original value. This function applies the mathematical floor operation element-wise across the entire array, which is useful for data discretization, quantization, and integer conversion in time series data.
You can use series_floor when you want to convert floating-point values to integers by rounding down, discretize continuous data into bins, or prepare data for categorical analysis. This is particularly useful for creating integer-based categories, implementing quantization schemes, or when you need to ensure values don’t exceed certain thresholds. Typical applications include data binning, performance categorization, and mathematical modeling where integer values are required.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk SPL, floor operations are typically done with the
eval function and the floor() expression. To compute floor across multiple values, you usually need to expand arrays and apply the transformation row by row. In APL, series_floor works directly on dynamic arrays, making it efficient for series-wide floor operations.ANSI SQL users
ANSI SQL users
In SQL, floor operations use the
FLOOR() function, but this only works on single values, not arrays. To compute floor for array elements, you typically need to unnest arrays and apply FLOOR() row by row. In APL, series_floor eliminates this complexity by directly applying floor transformation to each element in an array.Usage
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
array | dynamic | A dynamic array of numeric values. |
Returns
A dynamic array where each element is the floor (largest integer less than or equal to) the corresponding input element.Use case examples
- Log analysis
- OpenTelemetry traces
- Security logs
In log analysis, you can use Run in PlaygroundOutput
This query converts floating-point request durations to integers by rounding down, useful for creating discrete performance categories.
series_floor to discretize request durations into integer bins for categorical analysis or performance categorization.Query| id | durations | floor_durations |
|---|---|---|
| u123 | [150.7, 200.3, 250.9] | [150, 200, 250] |
| u456 | [100.2, 300.8, 400.1] | [100, 300, 400] |
List of related functions
- series_abs: Returns the absolute value of each element in an array. Use when you need to normalize values before applying floor operations.
- series_exp: Calculates the exponential of each element in an array. Use for exponential transformations instead of floor operations.
- series_cos: Returns the cosine of each element in an array. Use for trigonometric transformations instead of floor operations.
- series_sin: Returns the sine of each element in an array. Use for periodic transformations instead of floor operations.
- series_tan: Returns the tangent of each element in an array. Use for trigonometric transformations with different periodicity.