Signature | Description |
---|---|
std::pair<std::size_t, std::size_t> shape(); |
It returns a pair containing number of rows and columns. NOTE: Number of rows is the number of index rows. Not every column has the same number of rows, necessarily. But each column has, at most, this number of rows. |
std::vector<unsigned long> idx = { 123450, 123451, 123452, 123453, 123454, 123455, 123456 }; std::vector<double> d1 = { 1, 2, 3, 4, 5, 6, 7 }; std::vector<double> d2 = { 8, 9, 10, 11, 12, 13, 14 }; std::vector<double> d3 = { 15, 16, 17, 18, 19, 20, 21 }; std::vector<double> d4 = { 22, 23, 24, 25 }; std::vector<std::string> s1 = { "11", "22", "33", "ee", "ff", "gg", "ll" }; MyDataFrame df; auto shape = df.shape(); assert(shape.first == 0); assert(shape.second == 0); df.load_data(std::move(idx), std::make_pair("col_1", d1), std::make_pair("col_2", d2), std::make_pair("col_3", d3), std::make_pair("col_str", s1)); df.load_column("col_4", std::move(d4), nan_policy::dont_pad_with_nans); shape = df.shape(); assert(shape.first == 7); assert(shape.second == 5);