hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.54k stars 313 forks source link

ERROR: Number of rows requested 1 is more than available rows 2 #198

Closed SoftwareDogZ closed 2 years ago

SoftwareDogZ commented 2 years ago

When I called the function get_data_by_rand<...>(random_policy::num_rows_no_seed, 1), it threw an ERROR as mentioned in the title. I don't understand why this function cannot randomly select one row from a two-row dataframe. Then I looked into the corresponding piece of codes (Line 1362 in DataFrame_get.tcc) and I found the code _index_s > 0 && n_rows < indexs - 1 in the IF-condition. I'm wondering why it's necessary that n_rows is lower than index_s-1 (I think _n_rows <= indexs would be correct). Hoping for your response.

hosseinmoein commented 2 years ago

I will take a look. Thx

hosseinmoein commented 2 years ago

This has been fixed in master