I have a df composed by "date", "high_price", "closing_price".
d = {'date': [2000, 2001], 'high_price': [10, 15], 'closing_price': [13, 16]}
df = pd.DataFrame(data=d)
print(df)
date high_price closing_price
0 2000 10 13
1 2001 15 16
My desired output is to have a df with two features: "date" and "prices" that look like this:
d = {'date': [2000, 2000, 2001, 2001],'price_type':['high','close','high','close'], 'price': [10, 13,15,16]}
df = pd.DataFrame(data=d)
print(df)
date price_type price
0 2000 high 10
1 2000 close 13
3 2001 high 15
4 2001 close 16
Which smart function from pandas can I use to do so? Thanks