Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1#include "CSVReader.h"
2#include "DataFrame.h"
3#include <iostream>
4
5int main() {
6 CSVReader pd;
7
8 CSVOptions options;
9 options.hasIndex = false;
10 options.indexType = typeid(std::string);
11 options["truc1"] = typeid(int);
12 // options["truc2"] = typeid(double);
13 // options["truc3"] = typeid(double);
14
15
16 DataFrame df = pd.read_csv("data.csv", options);
17 df.print();
18 df.getColumn<double>("truc2").print();
19 df.head();
20
21 df.describe();
22
23 df.to_csv("output.csv");
24 std::cout << df.columns << std::endl;;
25 std::cout << df.index << std::endl;
26
27
28 std::cout << df.shape << std::endl;
29
30
31 return 0;
32}
Helper for loading CSV files into a DataFrame.
int main()
Definition main.cpp:5
Minimal tabular container with column-wise storage and CSV I/O.
CSV → DataFrame loader with basic type handling.
Definition CSVReader.h:36
DataFrame read_csv(const std::string &filename, CSVOptions options=CSVOptions())
Read a CSV file and construct a DataFrame.
Definition CSVReader.cpp:45
Simple column-oriented data structure with basic analysis utilities.
Definition DataFrame.h:61
void print() const
Prints the DataFrame to std::cout in a tabular format.
Definition DataFrame.cpp:27
DataFrame head(size_t n=5) const
Returns a new DataFrame with the first n rows.
Definition DataFrame.cpp:74
void describe() const
Prints a summary for all numeric columns.
std::array< int, 2 > shape
Shape of the DataFrame: {nRows, nCols}.
Definition DataFrame.h:86
Series< T > getColumn(const std::string &colName) const
Returns a copy of a column as a Series<T>.
void to_csv(const std::string &filename)
Serializes the DataFrame to a CSV file.
std::vector< std::string > index
Optional index labels for the rows (if set).
Definition DataFrame.h:79
std::vector< std::string > columns
List of column names, in insertion order.
Definition DataFrame.h:76
Options describing how to interpret or write CSV data.
Definition CSVOptions.h:31
std::type_index indexType
Type used for the DataFrame index.
Definition CSVOptions.h:50
bool hasIndex
True if the CSV representation contains a separate index column.
Definition CSVOptions.h:33