15 #ifndef CORE_UTIL_CSV_READER_H_
16 #define CORE_UTIL_CSV_READER_H_
35 std::cout <<
"Error: " << file <<
" does not exist!" << std::endl;
38 rapidcsv::LabelParams labels(skip);
39 rapidcsv::SeparatorParams separator;
40 rapidcsv::ConverterParams converter(
true);
41 doc_ = rapidcsv::Document(file, labels, separator, converter);
48 std::vector<T>
GetColumn(
const std::string& column_name) {
49 return doc_.GetColumn<T>(column_name);
54 return doc_.GetCell<T>(col, row);
65 std::vector<std::string> ids =
doc_.GetColumn<std::string>(column_name);
70 template <
typename T =
float,
typename Lambda>
72 for (
auto val : GetColumn<T>(column_name)) {
73 if (!std::isnan(val)) {
80 std::cout <<
"Filename\t\t: " <<
filename_ << std::endl;
81 std::cout <<
"Row count\t\t: " <<
num_rows_ << std::endl;
82 std::cout <<
"Column count\t\t: " <<
num_cols_ << std::endl;
83 auto num_bad_entries =
85 std::cout <<
"Bad entries\t\t: " << num_bad_entries << std::endl;
99 #endif // CORE_UTIL_CSV_READER_H_