mlresearch.utils.dataframe_to_image

mlresearch.utils.dataframe_to_image(df, bands=None, target_feature=None)[source]

Converts a pandas dataframe to an image. The height (“h”), and width (“w”) coordinates of the image must be in the index.

Parameters:
dfpd.DataFrame

Dataframe with pixel coordinates (h, w) as index, counting from the top left corner.

bandsarray-like of shape (b,), default=None

The names of the bands in the dataframe to be passed to the image.

target_featurestr, default=None

Target feature name.

Returns:
Xarray-like of shape (h, w, b)

Matrix containing the image data.

yarray-like of shape (h, w), default=None

The target values (class labels) as integers or strings.

bandsarray-like of shape (b,), default=None

The names of the bands in the image.