cudf.DataFrame.take#
- DataFrame.take(indices, axis=0)#
Return a new frame containing the rows specified by indices.
- Parameters
- indicesarray-like
Array of ints indicating which positions to take.
- axisUnsupported
- Returns
- outSeries or DataFrame
New object with desired subset of rows.
Examples
Series >>> s = cudf.Series([‘a’, ‘b’, ‘c’, ‘d’, ‘e’]) >>> s.take([2, 0, 4, 3]) 2 c 0 a 4 e 3 d dtype: object
DataFrame
>>> a = cudf.DataFrame({'a': [1.0, 2.0, 3.0], ... 'b': cudf.Series(['a', 'b', 'c'])}) >>> a.take([0, 2, 2]) a b 0 1.0 a 2 3.0 c 2 3.0 c >>> a.take([True, False, True]) a b 0 1.0 a 2 3.0 c