openGPMP
Open Source Mathematics Package
Functions
tables.cpp File Reference
#include <algorithm>
#include <chrono>
#include <fstream>
#include <iostream>
#include <openGPMP/core/datatable.hpp>
#include <regex>
#include <sstream>
#include <string>
#include <typeinfo>
#include <vector>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 12 of file tables.cpp.

12  {
13  /*
14  * for now specific columns must be in the order they appear in the file
15  * being read in
16  */
17  std::chrono::steady_clock::time_point start_time =
18  std::chrono::steady_clock::now();
20 
21  // DataTableStr is of type std::pair<std::vector<std::string>,
22  gpmp::core::DataTableStr result = dt.csv_read("../../data/1m.csv");
23 
24  // display() takes a DataTableStr or default to displaying the current obj
25  dt.display(result);
26 
27  // time the time taken to perform the DataTable methods
28  std::chrono::steady_clock::time_point end_time =
29  std::chrono::steady_clock::now();
30 
31  std::cout << "\nTime elapsed: "
32  << std::chrono::duration_cast<std::chrono::milliseconds>(
33  end_time - start_time)
34  .count()
35  << " ms" << std::endl;
36 
37  return 0;
38 }
DataTableStr csv_read(std::string filename, std::vector< std::string > columns={})
Reads a CSV file and returns a DataTableStr parses CSV files and stores all data as strings.
Definition: datatable.cpp:57
void display(std::pair< std::vector< T >, std::vector< std::vector< T >>> data, bool display_all=false)
Sort a DataTable based on a specified column.
Definition: datatable.hpp:216
std::pair< std::vector< std::string >, std::vector< std::vector< std::string > > > DataTableStr
Definition: datatable.hpp:65

References gpmp::core::DataTable::csv_read(), and gpmp::core::DataTable::display().