I am trying to make a 3d list from a pandas dataframe. It has 9 columns and 1440 rows. How do I make a list consisting of all values in a row of one value from a specific row and column that is apart of a list , in a list of each row (1440) making a 3d list of shape (1440, 9, 1) (1440, 1, 9) in the most efficient way. Here's an example of the data:
+-------------------------------------------------------------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 |
+-------------------------------------------------------------------------------------------------------+
| 2429896.0 4508569.0 3908478.0 5720432.0 470717.0 894550.0 703861.0 51111.0 0.017544 59.0 |
| 2555574.0 4740368.0 4109880.0 6021743.0 495871.0 940702.0 740383.0 1106141.0 0.058824 59.0 |
| 2555514.0 4741014.0 4110097.0 6021093.0 494950.0 939817.0 739364.0 1104789.0 0.017544 59.0 |
+-------------------------------------------------------------------------------------------------------+
You can use a couple of list comprehensions:
Output: