long_df_to_wide_ndarray#
- caf.toolkit.pandas_utils.df_handling.long_df_to_wide_ndarray(*args, **kwargs)[source]#
Convert a DataFrame from long to wide format, infilling missing values.
Similar to the long_to_wide_infill() function, but returns a numpy array instead.
- Parameters:
matrix – The matrix, in long format (i.e. a Series), to convert to wide.
- Return type:
ndarray
- infill:
The value to use to infill any missing cells in the wide DataFrame.
- unstack_level:
The level to unstack from the index. This can either be an int, i.e. the ordinal level of the multiindex to unstack, or a string, i.e. the name of the index level to unstack.
- check_totals:
Whether to check if the totals are almost equal before and after the conversion.
- Returns:
An ndarray, in wide format, with index_col as the index, columns_col as the column names, and values_col as the values.
- Return type:
wide_ndarray
See also