eis/mix_cc/dataframe/dataframe.h

47 lines
1.2 KiB
C++

#pragma once
#pragma GCC warning \
"This Library is still in develop, Do NOT USE in Production Environment"
#include "mix_cc/dataframe/detail/eigen_helper.h"
#include "mix_cc/dataframe/detail/inner_exp.h"
#include <eigen3/Eigen/Core>
#include <functional>
#include <memory>
#include <string>
#include <vector>
namespace mix_cc {
namespace dataframe {
/**
* @brief dataframe for c++ eigen3 struct
*/
class DataFrame {
private:
std::vector<std::string> col_name_;
Eigen::MatrixXd data_;
std::unique_ptr<detail::inner_exp> filter_exp_;
std::vector<std::unique_ptr<detail::inner_exp>> transfor_exp_;
public:
DataFrame(const std::vector<std::string>& col_name,
const Eigen::MatrixXd& matrix_data)
: col_name_(col_name), data_(matrix_data) {}
~DataFrame();
size_t row_count() const { return data_.rows(); }
size_t col_count() const { return data_.rows(); }
auto row(size_t index) const { return data_.row(index); }
auto col(size_t index) const { return data_.col(index); }
void filter(std::string& filter_exp_str);
void transform(std::vector<std::string>& transfor_exp_strs);
};
} // namespace dataframe
} // namespace mix_cc