Understanding index column in a StdDataFrame<I>
and templating
#287
-
One thing I've not understood from the docs is why template the index type for a However it is also valid to create a std::vector<double> dblvec2 = { 0.998, 0.3456, 0.056, 0.15678, 0.00345, 0.923, 0.06743, 0.1 };
std::vector<std::string> strvec = { "Col_name", "Col_name", "Col_name", "Col_name", "Col_name" };
StdDataFrame<bool> df2;
df2.load_data(std::move(idx_bool),
std::make_pair("dbl_col_2", dblvec2),
std::make_pair("str_col", strvec)); I just want to better understand some of the reasoning/use; the why behind the way I'm in the process of learning so thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
An index column in a DataFrame is unlike an index in a SQL table. SQL table index makes access efficient. It doesn’t give you any more information. The index column in a DataFrame is metadata about the data in the DataFrame. Each entry in the index describes the given row. It could be time, frequency, …, or a set of descriptors in a struct (like temperature, altitude, …). So, there can be almost infinite possibilities. That’s why I kept the index column as a template which also differentiates the DataFrame type. |
Beta Was this translation helpful? Give feedback.
An index column in a DataFrame is unlike an index in a SQL table. SQL table index makes access efficient. It doesn’t give you any more information. The index column in a DataFrame is metadata about the data in the DataFrame. Each entry in the index describes the given row. It could be time, frequency, …, or a set of descriptors in a struct (like temperature, altitude, …). So, there can be almost infinite possibilities. That’s why I kept the index column as a template which also differentiates the DataFrame type.
Whether a bool index column type is relevant or not is unimportant.