0

I have a crosstab:

1            Erratic  Intermittent  Lumpy  Smooth  
2                                                          
Intermittent       20            77      9     450        
Lumpy              10             6      1      13       
Unknown             0            13      1       1   

Result:

1               2              Value
Intermittent    Erratic        20
Lumpy           Erratic        10
Unknown         Erratic        0
Intermittent    Intermittent   77
Lumpy           Intermittent   6
Unknown         Intermittent   13
Intermittent    Lumpy          9
Lumpy           Lumpy          1
Unknown         Lumpy          1
Intermittent    Smooth         450
Lumpy           Smooth         13
Unknown         Smooth         1

Basically I need to convert that matrix to simple dataframe

Kyra
  • 29
  • 6
  • 1
    `df = df.melt(ignore_index=False)` – jezrael Dec 02 '21 at 08:00
  • @jezrael And if I want that column name 1 and 2 in the column values then? like For Column 1 : Intermittent as Intermittent_1 and For Column 2: Erratic as Erractic_2 – Kyra Dec 02 '21 at 08:04

0 Answers0