To achieve this, you can use the pandas library to read the excel files and manipulate the data to construct a 3D array.
First, you need to import pandas library:
main.py20 chars2 lines
Then, you can use the read_excel()
function to read the data from the excel files. Let's assume that the column data from the first file is in column A and the second file is in column B. You can read both files as follows:
main.py98 chars3 lines
Next, you can use the numpy
library to construct a 3D numpy array. Let's assume that you want to use the first 10 rows of data from file1 and file2 to construct the 3D array. You can do this as follows:
main.py227 chars8 lines
This will create a 3D numpy array with data1
as the first slice and data2
as the second slice. You can access a specific slice of the array as follows:
main.py97 chars3 lines
You can then manipulate the data in the slices as needed.
gistlibby LogSnag