Extracting selected columns to new DataFrame as a copy in python
You can use the following code, (here df is your data frame)-
pd.DataFrame({"Date":df.values.flatten(), "intent":df.columns.tolist()*65})
I have the following intent classification data (4 columns, 65 rows):
Columns:     intent-A       intent-B       intent-C       intent-D
records:             d1a                   d1b                   d1c                    d1d
                             d2a                     d2b                   d2c                    d2d
I am attempting to combine the columns into two columns to look like this (2 columns, 260 rows):
data     intent
d1a    intent-A
d1b      intent-B
d1c      intent-C
d1d      intent-D

d2a      intent-A

d2b        intent-B

d2c        intent-C

d2d        intent-D
I am using pandas DataFrame and have tried using different functions with no success (append, concat, etc.). Any help would be most appreciated!