dataFrame.hpp
Go to the documentation of this file.
36 DataFrame(std::string file_name, char delimiter, bool first_row_is_column_names, int primery_key = 0);
129 return ObjectFactory<T>::instance().getObject(data_[primary_key_[row]-1][column_names_[col]-1]);
void createColumnNames(bool first_row)
creates columns names basing on the first row of csv file
Definition: dataFrame.cpp:70
std::map< std::string, int > primary_key_
Maps row name to row number.
Definition: dataFrame.hpp:92
File contains template of deep-coping smart pointer.
std::map< std::string, int > column_names_
Maps column name to column number.
Definition: dataFrame.hpp:91
void append(const DataEntryClerk &)
adds data stored by DataEntryClerk
Definition: dataFrame.cpp:207
std::vector< std::string > getColumnNames() const
Returns column names as vector of strings.
Definition: dataFrame.cpp:335
Date getDate(const int col, const int row, Date::Format fmt)
Reads cell in c-th column and r-th row.
Definition: dataFrame.cpp:176
File contains definition of Factory pattern.
std::map< std::string, std::string > data_
Maps that stores inputs provided using method DataEntryClerk::add.
Definition: dataFrame.hpp:241
Definition: cadHoliday.cpp:3
friend std::ostream & operator<<(std::ostream &, DataFrame &)
Overloads stream operator.
Definition: dataFrame.cpp:387
DataEntryClerk()
Default constructor.
Definition: dataFrame.hpp:222
void add(const std::map< std::string, T > &input)
add a map to data
Definition: dataFrame.hpp:234
int getNumberOfColumns() const
Returns number of columns.
Definition: dataFrame.cpp:357
Class used to provide data to julian::DataFrame.
Definition: dataFrame.hpp:217
double getDouble(const int col, const int row)
Reads cell in c-th column and r-th row.
Definition: dataFrame.cpp:146
int getNumberOfRows() const
Returns number of rows.
Definition: dataFrame.cpp:351
File contains definition of date class.
SmartPointer< T > getObject(std::string name)
returns the a SmartPointer pointing new object of type dependent on string provided ...
Definition: objectFactory.hpp:75
std::vector< std::string > getPrimaryKeys() const
Returns primary keys as vector of strings.
Definition: dataFrame.cpp:325
File contains definition of Factory pattern.
static ObjectFactory & instance()
returns reference to instance of singleton factory
Definition: objectFactory.hpp:87
SmartPointer< T > getObject(const int col, const int row)
Reads cell in c-th column and r-th row.
Definition: dataFrame.hpp:103
void parseFile(std::string file_name, char delimiter)
parse csv file, result of method is saved in DataFrame::data_
Definition: dataFrame.cpp:37
T getValue(const int col, const int row)
Reads cell in c-th column and r-th row.
Definition: dataFrame.hpp:138
File contains definition of tenor class.
std::map< std::string, std::string > getRow(int row) const
Returns row in form of std::map.
Definition: dataFrame.cpp:363
DataFrame filter(int col, T filter)
Filter the data frame basing on data hold in column.
Definition: dataFrame.hpp:173
T getValue(std::string name)
returns enumeration value
Definition: valueFactory.hpp:62
static ValueFactory & instance()
returns reference to instance of singleton factory
Definition: valueFactory.hpp:52
void printToCsv(std::string file_name, char delimiter= ';')
prints DataFrame to csv file
Definition: dataFrame.cpp:294
std::string operator()(const int col, const int row)
Reads cell in c-th column and r-th row.
Definition: dataFrame.cpp:92
std::vector< std::vector< std::string > > data_
Holds data as 2d table of strings.
Definition: dataFrame.hpp:90
File contain time units and other useful enumerations.