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
  hi guys, I got data reader error while pulling the data from yahoo gokulrajkmv 1 120 May-15-2020, 11:08 AM
Last Post: snippsat
  Insert data into sql after joining two excel data from python NeerajYadav 2 249 Jan-29-2020, 02:29 PM
Last Post: parthi1705
  Converting query string as a condition for filter data. shah_entrance 1 151 Jan-14-2020, 09:22 AM
Last Post: perfringo
  converting data sizes like: 4k, 32k, 4m, 16m, 1g, etc Skaperen 1 316 Jul-16-2019, 01:37 AM
Last Post: Skaperen
  Data Hygiene, classes and magic reappearance of data praevalens 2 398 Mar-02-2019, 04:05 PM
Last Post: praevalens
  I can't write my data to the data file , Why? canatilaa 4 695 Jan-08-2019, 10:50 PM
Last Post: canatilaa
  Storing MySQL BIT Data Type data in python variable krushna 2 939 Dec-31-2018, 01:28 AM
Last Post: krushna
  How to sample data from training data set? python_newbie09 0 741 Jan-12-2018, 08:07 PM
Last Post: python_newbie09
  python data format to c data format tony1812 1 998 Dec-02-2017, 12:34 AM
Last Post: Larz60+
  Problem with serial data. How do I ignor incorrect data? donmerch 1 1,319 Jul-11-2017, 01:55 AM
Last Post: donmerch

Forum Jump:


Users browsing this thread: 1 Guest(s)