cudf.DataFrame.stack#

DataFrame.stack(level=- 1, dropna=True)#

Stack the prescribed level(s) from columns to index

Return a reshaped Series

Parameters
dropnabool, default True

Whether to drop rows in the resulting Series with missing values.

Returns
The stacked cudf.Series

Examples

>>> import cudf
>>> df = cudf.DataFrame({'a': [0, 1, 3], 'b': [1, 2, 4]})
>>> df.stack()
0  a    0
   b    1
1  a    1
   b    2
2  a    3
   b    4
dtype: int64