I'm reading in a CSV that has 3 columns. On each column I need to perform the mean, var, and std calculations. I'm able to get the output for the first column but dont know how to have it print all 3 columns. Thanks.
I tried adding ','
after line
in
while (getline(inNew, line, ','))
but that doesnt work for me
int main()
{
ifstream inNew("C:/Users/A.csv");
accumulator_set<double, stats<tag::mean, tag::variance >> acc;
if (inNew)
{
string line;
while (getline(inNew, line))
{
acc(stod(line));
}
cout << "Expected return is: " << mean(acc) << std::endl;
cout << "Variance: " << variance(acc) << std::endl;
cout << "Std Dev: " << sqrt(variance(acc)) << std::endl;
}
inNew.close();
system("pause");
return 0;
}