frlearn.utils.np_utils.first

frlearn.utils.np_utils.first(a, k, axis=-1)[source]

Returns the k first values of a along the specified axis. If k is in (0, 1), it is interpreted as a fraction of the total number, with a minimum of 1. If k is None, all values of a will be returned.

Parameters
andarray

Input array of values.

kint or float or None

Number of values to return. If a float in (0, 1), taken as a fraction of the total number of values. If None, all values are returned.

axisint, default=-1

The axis along which values are selected.

Returns
first_along_axisndarray

An array with the same shape as a, with the specified axis reduced according to the value of k.