template<typename ... Ts>
DataFrame
get_data_by_rand(random_policy spec, double n, size_type seed = 0) const;
|
It returns a DataFrame (including the index and data columns) containing the data from uniform random selection. random_policy determines the behavior of method.
NOTE: The actual number of rows returned might be smaller than requested. That is because the random process might produce the same number more than once.
NOTE: The columns in the result are not padded with NaN.
|
Ts: The list of types for all columns. A type should be specified only once.
random_policy: Please see random_policy in DataFrameTypes.h. It specifies how this function should proceed.
n: Depending on the random policy, it is either the number of rows to sample or a fraction of rows to sample. In case of fraction, for example 0.4 means 40% of rows.
seed: Depending on the random policy, user could specify a seed. The same seed should always produce the same random selection.
|
template<typename ... Ts>
DataFramePtrView<I>
get_view_by_rand(random_policy spec, double n, size_type seed = 0) const;
|
It behaves like get_data_by_rand(), but it returns a DataFrameView. A view is a DataFrame that is a reference to the original DataFrame. So if you modify anything in the view the original DataFrame will also be modified.
NOTE: There are certain operations that you cannot do with a view. For example, you cannot add/delete columns, etc.
NOTE: The columns in the result are not padded with NaN.
NOTE: Although this is a const method, it returns a view. So, the data could still be modified through the returned view
|
Ts: The list of types for all columns. A type should be specified only once.
random_policy: Please see random_policy in DataFrameTypes.h. It specifies how this function should proceed.
n: Depending on the random policy, it is either the number of rows to sample or a fraction of rows to sample. In case of fraction, for example 0.4 means 40% of rows.
seed: Depending on the random policy, user could specify a seed. The same seed should always produce the same random selection.
|