C ++ pivot table implementation

Similar to this question Pivot table in C # , I am looking to find a pivot table implementation in C ++. Due to project requirements, the speed is quite critical, and the rest of the project with critical performance parameters is written in C ++, so an implementation in C ++ or called from C ++ will be very desirable. Does anyone know of a pivot table implementation similar to the one found in Excel or an open office?

I would rather not code such a thing from scratch, but if I were to do it, how should I do it? What algorithms and data structures would be good to understand? Any links to the algorithm would be greatly appreciated.

+5
source share
3 answers

I am sure that you are not requesting the full pivot table function in Excel. I think you need a simple statistics table based on discrete explanatory variables and statistics data. If you do this, I think it is so that writing from scratch can be faster than looking at other implementations.

Just update the std :: map (or similar data structure) of a key that represents a combination of explanatory variables and statistics data values ​​when reading each data point.

After reading, you just need to organize an output table with a map, which may be trivial depending on your goal.

I believe that most of the C # examples in this question that you have linked all the same use this approach.

+3
source

, , , , ...

SQLite SQL (: SQL , - , ). SQLite , , . , , , .

-- , , . Qt, Qt QTableView QStandardItemModel ( ) QAbstractItemModel ( ). , , , :).

, , , .

0

, , , , , , .

In the pivot table is the basic form that goes through the data, the aggregation of operations in buckets. For example, you want to see how many goods you sent every week from each warehouse over the past few weeks:

You will create a multidimensional array of buckets (rows - weeks, columns - warehouses) and skip the data, deciding which bucket this data belongs to, adding the amount to the record you are looking at and moving to the next record.

0
source

All Articles