Stack up the pandas dataframe and repeat the

We have from pandas website an example of stacking dataframe
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.stack.html

     weight height
cat       0      1
dog       2      3
df_single_level_cols.stack(future_stack=True)
cat  weight    0
     height    1
dog  weight    2
     height    3
dtype: int64

How may I get the following results – to repeat the indices so that all columns/rows have the same number of observation?


cat  weight    0
cat  height    1
dog  weight    2
dog  height    3
dtype: int64

Thanks!

I think this is the search query you want.