starepandas.STAREDataFrame.to_arrays#

STAREDataFrame.to_arrays(shape=None, pivot=False)#

Converts a STAREDataFrame into a dictionary of arrays; one array per column/field.

This may be useful to write data back to granules. Either a shape argument has to be provided or the dataframe has to contain a column x and y holding the original array coordinates. If no shape is provided, the shape is assumed to be (max(x)+1, max(y)+1).

If the dataframe has x/y columns, the column can also be pivoted. I.e. rather than reshaping according to the shape, pivoted along the x/y columns. This may be relevant if the dataframe’s row order has changed.

Parameters
shape: tuple

x and y shape of the array. x*y has to equal the length of the dataframe

pivot: bool

if true, rather than simple reshaping, the dataframe is pivoted along the x and y column