|
Vince's CSV Parser
|
Class for calculating statistics from CSV files and in-memory sources. More...
#include <csv_stat.hpp>
Public Types | |
| using | FreqCount = std::unordered_map< std::string, size_t > |
| using | TypeCount = std::unordered_map< DataType, size_t > |
Public Member Functions | |
| std::vector< long double > | get_mean () const |
| Return current means. | |
| std::vector< long double > | get_variance () const |
| Return current variances. | |
| std::vector< long double > | get_mins () const |
| Return current mins. | |
| std::vector< long double > | get_maxes () const |
| Return current maxes. | |
| std::vector< FreqCount > | get_counts () const |
| Get counts for each column. | |
| std::vector< TypeCount > | get_dtypes () const |
| Get data type counts for each column. | |
| std::vector< std::string > | get_col_names () const |
| CSVStat (csv::string_view filename, CSVFormat format=CSVFormat::guess_csv()) | |
| Calculate statistics for an arbitrarily large file. | |
| CSVStat (std::stringstream &source, CSVFormat format=CSVFormat()) | |
| Calculate statistics for a CSV stored in a std::stringstream. | |
Class for calculating statistics from CSV files and in-memory sources.
Example
Definition at line 18 of file csv_stat.hpp.
| using csv::CSVStat::FreqCount = std::unordered_map<std::string, size_t> |
Definition at line 20 of file csv_stat.hpp.
| using csv::CSVStat::TypeCount = std::unordered_map<DataType, size_t> |
Definition at line 21 of file csv_stat.hpp.
| csv::CSVStat::CSVStat | ( | csv::string_view | filename, |
| CSVFormat | format = CSVFormat::guess_csv() |
||
| ) |
Calculate statistics for an arbitrarily large file.
When this constructor is called, CSVStat will process the entire file iteratively. Once finished, methods like get_mean(), get_counts(), etc... can be used to retrieve statistics.
Definition at line 13 of file csv_stat.cpp.
Calculate statistics for a CSV stored in a std::stringstream.
Definition at line 19 of file csv_stat.cpp.
|
inline |
Definition at line 30 of file csv_stat.hpp.
| std::vector< CSVStat::FreqCount > csv::CSVStat::get_counts | ( | ) | const |
Get counts for each column.
Definition at line 61 of file csv_stat.cpp.
| std::vector< CSVStat::TypeCount > csv::CSVStat::get_dtypes | ( | ) | const |
Get data type counts for each column.
Definition at line 70 of file csv_stat.cpp.
| std::vector< long double > csv::CSVStat::get_maxes | ( | ) | const |
Return current maxes.
Definition at line 52 of file csv_stat.cpp.
| std::vector< long double > csv::CSVStat::get_mean | ( | ) | const |
Return current means.
Definition at line 25 of file csv_stat.cpp.
| std::vector< long double > csv::CSVStat::get_mins | ( | ) | const |
Return current mins.
Definition at line 43 of file csv_stat.cpp.
| std::vector< long double > csv::CSVStat::get_variance | ( | ) | const |
Return current variances.
Definition at line 34 of file csv_stat.cpp.