The trick is to use stack()
df.stack().reset_index()
level_0 level_1 0
0 0 Column 1 A
1 0 Column 2 E
2 1 Column 1 B
3 1 Column 2 F
4 2 Column 1 C
5 2 Column 2 G
6 3 Column 1 D
7 3 Column 2 H
More Related Contents:
- Fast punctuation removal with pandas
- How to one-hot-encode from a pandas column containing a list?
- Skip rows during csv import pandas
- Rename Pandas DataFrame Index
- Pandas groupby cumulative sum
- What is the fastest way to upload a big csv file in notebook to work with python pandas?
- pandas dataframe groupby datetime month
- Pandas DataFrame concat vs append
- Pandas counting and summing specific conditions
- How to add multiple annotations to a barplot
- How do I get the row count of a Pandas DataFrame?
- forward fill specific columns in pandas dataframe
- How can I replicate rows in Pandas?
- pandas – get most recent value of a particular column indexed by another column (get maximum value of a particular column indexed by another column)
- How to create a DataFrame of random integers with Pandas?
- summing two columns in a pandas dataframe
- add a row at top in pandas dataframe [duplicate]
- Create new column based on values from other columns / apply a function of multiple columns, row-wise in Pandas
- Computing diffs within groups of a dataframe
- Specifying date format when converting with pandas.to_datetime
- Is it possible to add a string as a legend item in matplotlib
- Nested Dictionary to MultiIndex pandas DataFrame (3 level)
- Grouped Bar graph Pandas
- KeyError when indexing Pandas dataframe
- countplot with normalized y axis per group
- Check if certain value is contained in a dataframe column in pandas [duplicate]
- double quoted elements in csv cant read with pandas
- Pandas: Find rows which don’t exist in another DataFrame by multiple columns
- Resample time series in pandas to a weekly interval
- how to understand closed and label arguments in pandas resample method?