Bottom Page

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Converting raw data into panel data
#1
I have a problem about converting raw data into panel data.
I got the following data in excel like:
Name MMMmarketcap MMMstoctprice APPLmarketcap APPLstoctprice ... (i)marketcap (i)stockprice
01/2001 a1 b1 c1 d1
.... ... ... ... ...
05/2018 an bn ... ...
How can I convert the data into panel format like:
Date Name MarketCap Stock Price
01/2001 MMM a1 b1
....
05/2018
01/2001 AAPL c1 d1
....
05/2018
I try but i cannot get the result expected :
df1 = pd.melt(df,id_vars=["Name"])
I got something like:
Name Variable Value
01/2001 MMMmarketcap a1
....
05/2018 MMMmarketcap an
01/2011 MMMstockprice b1
....
05/2018 MMM stockprice bn

Many thanks for helping.
Quote
#2
why are you running subject words together? It's annoying and not necessary
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  converting data sizes like: 4k, 32k, 4m, 16m, 1g, etc Skaperen 1 154 Jul-16-2019, 01:37 AM
Last Post: Skaperen
  Data Hygiene, classes and magic reappearance of data praevalens 2 213 Mar-02-2019, 04:05 PM
Last Post: praevalens
  I can't write my data to the data file , Why? canatilaa 4 444 Jan-08-2019, 10:50 PM
Last Post: canatilaa
  Storing MySQL BIT Data Type data in python variable krushna 2 552 Dec-31-2018, 01:28 AM
Last Post: krushna
  How to sample data from training data set? python_newbie09 0 601 Jan-12-2018, 08:07 PM
Last Post: python_newbie09
  python data format to c data format tony1812 1 805 Dec-02-2017, 12:34 AM
Last Post: Larz60+
  Problem with serial data. How do I ignor incorrect data? donmerch 1 1,111 Jul-11-2017, 01:55 AM
Last Post: donmerch

Forum Jump:


Users browsing this thread: 1 Guest(s)