bach.Series.unstack

unstack​

(level=- 1, fill_value=None, aggregation='max')

​[source]

Pivot a level of the index labels.

Returns a(n unsorted) DataFrame with the values of the unstacked index as columns. In case of duplicate index values that are unstacked, aggregation is used to aggregate the values.

Series’ index should be of at least two levels to unstack.

Parameters​

  • level (Union[int, str]) – selects the level of the index that is unstacked.
  • fill_value (Optional[Union[int, float, str, uuid.UUID]]) – replace missing values resulting from unstacking. Should be of same type as the series that is unstacked.
  • aggregation (str) – method of aggregation, in case of duplicate index values. Supports all aggregation methods that aggregate() supports.

Returns​

DataFrame

Return type​

bach.dataframe.DataFrame

note

This function queries the database.