# Importing modules
import pandas as pd
import numpy as np
# Create a dataframe
df = pd.DataFrame(np.random.randn(
5, 4), index='A B C D E'.split(), columns='W X Y Z'.split())
print(df)
# Reshape the dataframe
df = df.stack().reset_index()
print(df)