Computer scienceData scienceInstrumentsPandasData analysis with pandas

Reshaping and Pivot Tables

Melt

Report a typo

Imagine you work with the following pivoted dataset df:

+----------+-----+-----+
|   Letter | A   | B   |
|   Number |     |     |
|----------+-----+-----|
|        1 | A1  | B1  |
|        2 | A2  | B2  |
|        3 | A3  | B3  |
+----------+-----+-----+

How could you reshape the DataFrame to make it look like:

+----------+----------+-----------------+
|          | Letter   | Number&Letter   |
|   Number |          |                 |
|----------+----------+-----------------|
|        1 | A        | A1              |
|        2 | A        | A2              |
|        3 | A        | A3              |
|        1 | B        | B1              |
|        2 | B        | B2              |
|        3 | B        | B3              |
+----------+----------+-----------------+

Tip: Check the documentation to get the correct answer

Select one option from the list
___

Create a free account to access the full topic