I have the following problem that I am trying to solve. I have two Pandas Dataframe rows with the same columns:
Column A | Column B |
---|---|
Cell 1 | Cell 2 |
Cell 3 | Cell 4 |
I want to combine both rows into one single row by appending the columns:
Column A_1 | Column B_1 | Column A_2 | Column B_2 |
---|---|---|---|
Cell 1 | Cell 2 | Cell 3 | Cell 4 |
This operation is used to create a time series row with window size 2 for training a machine learning model. Therefore, I am doing this operation millions of times which should require a small operational cost.
Thanks in advance!
I tried using pandas concat but is is just too slow and requires a lot of ram