cudf.DataFrame.interleave_columns#

DataFrame.interleave_columns()[source]#

Interleave Series columns of a table into a single column.

Converts the column major table cols into a row major column.

Parameters:
colsinput Table containing columns to interleave.
Returns:
The interleaved columns as a single column

Pandas Compatibility Note

DataFrame.interleave_columns

This method does not exist in pandas but it can be run as pd.Series(np.vstack(df.to_numpy()).reshape((-1,))).

Examples

>>> import cudf
>>> df = cudf.DataFrame({0: ['A1', 'A2', 'A3'], 1: ['B1', 'B2', 'B3']})
>>> df
    0   1
0  A1  B1
1  A2  B2
2  A3  B3
>>> df.interleave_columns()
0    A1
1    B1
2    A2
3    B2
4    A3
5    B3
dtype: object