Here is my case : I had 3 matrix from Matlab (X,Y,Z) of size (126,321) X is the x coordinates, Y y coordinates, and Z the efficiency of a machine depending of the coordinates X and Y. I want to use the matrix Z in python. So I saved Z in a text file. But before I transposed it and rotate it by 90° (because the matrix in Matlab was not the same representation than the figure). Then I saved the vector with the x coordinates in a text file And I saved the vector with the y coordinates in a text file.
So I have 3 text file: - text1.txt with size (126,321) (it is Z) - text2.txt which is a line with 126 values - text3.txt which is a line with 321 values
What I would like to do is to create a DataFrame with pandas with text1 the data, text 2 the index, text3 the header.
I did the following code:
Efficiency=pd.read_csv('text1.txt',sep=';',header=None,index_col=False)
x=pd.read_csv('text3.txt',sep=';',header=None,index_col=False)
y=pd.read_csv('text2.txt',sep=';',header=None,index_col=False)
Efficiency.columns=x
Efficiency.index=y
But the two last lines are not working. I tried to pass by numpy but the results are not good also.
So if you have any explanation or solution just tell me !
Thanks a lot.