|
statcpp
C++17 Header-Only Statistics Library
|
Data wrangling (data manipulation and transformation) functions. More...
#include <algorithm>#include <cmath>#include <cstddef>#include <functional>#include <limits>#include <map>#include <numeric>#include <random>#include <stdexcept>#include <type_traits>#include <unordered_map>#include <unordered_set>#include <utility>#include <vector>#include "statcpp/basic_statistics.hpp"#include "statcpp/random_engine.hpp"Go to the source code of this file.
Classes | |
| struct | statcpp::group_result< K, V > |
| Grouping result. More... | |
| struct | statcpp::aggregation_result< K > |
| Aggregation result per group. More... | |
| struct | statcpp::label_encoding_result< T > |
| Label encoding result. More... | |
| struct | statcpp::validation_result |
| Data validation result. More... | |
Namespaces | |
| namespace | statcpp |
Functions | |
| bool | statcpp::is_na (double x) |
| Check if a value is NA. | |
| template<typename T > | |
| std::vector< std::vector< T > > | statcpp::dropna (const std::vector< std::vector< T > > &data) |
| Drop rows containing NA. | |
| template<typename T > | |
| std::vector< T > | statcpp::dropna (const std::vector< T > &data) |
| Drop NA from a 1-dimensional vector. | |
| template<typename T > | |
| std::vector< T > | statcpp::fillna (const std::vector< T > &data, T fill_value) |
| Fill NA with a specified value. | |
| std::vector< double > | statcpp::fillna_mean (const std::vector< double > &data) |
| Fill NA with mean. | |
| std::vector< double > | statcpp::fillna_median (const std::vector< double > &data) |
| Fill NA with median. | |
| std::vector< double > | statcpp::fillna_ffill (const std::vector< double > &data) |
| Fill NA with forward fill. | |
| std::vector< double > | statcpp::fillna_bfill (const std::vector< double > &data) |
| Fill NA with backward fill. | |
| std::vector< double > | statcpp::fillna_interpolate (const std::vector< double > &data) |
| Fill NA with linear interpolation. | |
| template<typename T , typename Predicate > | |
| std::vector< T > | statcpp::filter (const std::vector< T > &data, Predicate pred) |
| Filter elements that match a condition. | |
| template<typename T , typename Predicate > | |
| std::vector< std::vector< T > > | statcpp::filter_rows (const std::vector< std::vector< T > > &data, Predicate pred) |
| Filter rows that match a condition (2-dimensional) | |
| template<typename T > | |
| std::vector< T > | statcpp::filter_range (const std::vector< T > &data, T min_val, T max_val) |
| Filter values within a range. | |
| std::vector< double > | statcpp::log_transform (const std::vector< double > &data) |
| Logarithmic transformation (natural logarithm) | |
| std::vector< double > | statcpp::log1p_transform (const std::vector< double > &data) |
| Logarithmic transformation (log1p: log(1 + x)) | |
| std::vector< double > | statcpp::sqrt_transform (const std::vector< double > &data) |
| Square root transformation. | |
| std::vector< double > | statcpp::boxcox_transform (const std::vector< double > &data, double lambda) |
| Box-Cox transformation. | |
| std::vector< double > | statcpp::rank_transform (const std::vector< double > &data) |
| Rank transformation. | |
| template<typename K , typename V > | |
| group_result< K, V > | statcpp::group_by (const std::vector< K > &keys, const std::vector< V > &values) |
| Group by. | |
| template<typename K > | |
| aggregation_result< K > | statcpp::group_mean (const std::vector< K > &keys, const std::vector< double > &values) |
| Mean per group. | |
| template<typename K > | |
| aggregation_result< K > | statcpp::group_sum (const std::vector< K > &keys, const std::vector< double > &values) |
| Sum per group. | |
| template<typename K > | |
| aggregation_result< K > | statcpp::group_count (const std::vector< K > &keys, const std::vector< double > &values) |
| Count per group. | |
| template<typename T > | |
| std::vector< T > | statcpp::sort_values (const std::vector< T > &data, bool ascending=true) |
| Return a sorted vector (ascending) | |
| template<typename T > | |
| std::vector< std::size_t > | statcpp::argsort (const std::vector< T > &data, bool ascending=true) |
| Return indices in sorted order. | |
| template<typename T > | |
| std::vector< T > | statcpp::sample_with_replacement (const std::vector< T > &data, std::size_t n) |
| Random sampling (with replacement) | |
| template<typename T > | |
| std::vector< T > | statcpp::sample_without_replacement (const std::vector< T > &data, std::size_t n) |
| Random sampling (without replacement) | |
| template<typename K , typename V > | |
| std::vector< V > | statcpp::stratified_sample (const std::vector< K > &strata, const std::vector< V > &data, double sample_ratio) |
| Stratified sampling. | |
| template<typename T > | |
| std::vector< T > | statcpp::drop_duplicates (const std::vector< T > &data) |
| Drop duplicates. | |
| template<typename T > | |
| std::map< T, std::size_t > | statcpp::value_counts (const std::vector< T > &data) |
| Count duplicates. | |
| template<typename T > | |
| std::vector< T > | statcpp::get_duplicates (const std::vector< T > &data) |
| Get duplicate values. | |
| std::vector< double > | statcpp::rolling_mean (const std::vector< double > &data, std::size_t window) |
| Moving average. | |
| std::vector< double > | statcpp::rolling_std (const std::vector< double > &data, std::size_t window) |
| Moving standard deviation. | |
| std::vector< double > | statcpp::rolling_min (const std::vector< double > &data, std::size_t window) |
| Moving minimum. | |
| std::vector< double > | statcpp::rolling_max (const std::vector< double > &data, std::size_t window) |
| Moving maximum. | |
| std::vector< double > | statcpp::rolling_sum (const std::vector< double > &data, std::size_t window) |
| Moving sum. | |
| template<typename T > | |
| label_encoding_result< T > | statcpp::label_encode (const std::vector< T > &data) |
| Label encoding. | |
| template<typename T > | |
| std::vector< std::vector< double > > | statcpp::one_hot_encode (const std::vector< T > &data) |
| One-hot encoding. | |
| std::vector< std::size_t > | statcpp::bin_equal_width (const std::vector< double > &data, std::size_t n_bins) |
| Binning (equal width) | |
| std::vector< std::size_t > | statcpp::bin_equal_freq (const std::vector< double > &data, std::size_t n_bins) |
| Binning (equal frequency) | |
| validation_result | statcpp::validate_data (const std::vector< double > &data, bool allow_missing=false, bool allow_infinite=false, bool allow_negative=true) |
| Data validation. | |
| bool | statcpp::validate_range (const std::vector< double > &data, double min_val=-std::numeric_limits< double >::infinity(), double max_val=std::numeric_limits< double >::infinity()) |
| Range validation. | |
Variables | |
| constexpr double | statcpp::NA = std::numeric_limits<double>::quiet_NaN() |
| Constant representing NA (NaN) | |
Data wrangling (data manipulation and transformation) functions.
Provides missing value handling, filtering, transformation, grouping, aggregation, sampling, rolling aggregations, categorical encoding, and other functions.
Definition in file data_wrangling.hpp.