Pandas Series: unstack() function

Series-unstack() function

The unstack() function is used to reshape the data using stack() function in pandas converts the data into stacked format 

The level involved will automatically get sorted.


Series.unstack(self, level=-1, fill_value=None)
Pandas Series unstack image
Name Description Type/Default Value Required / Optional
level Level(s) to unstack, can pass level name. int, str, or list of these
Default Value: Last Level
fill_value Value to use when replacing NaN values. scalar value
Default Value: None

Returns: DataFrame - Unstacked Series.


Download the above Notebook from here.

Previous: Sorts Pandas series by labels along the given axis
Next: Explode list-likes including lists, tuples, Series, and np.ndarray