I'm trying to read in a .txt file into a dataframe using Pandas. The problem I'm getting is that the column names are in line with the data for each row. This makes it a little hard for me to get only the data since I'm not sure what the delimiter should be. My data looks like this: (full file here)
f= Al N= 1 rho[g/cc]= 0.269861 V[A^3]= 166.02561792 T[K]= 2020958 P[GPa]= 1877.100 24.300 E[Ha]= -59.56300000 1.39000000
f= Al N= 1 rho[g/cc]= 0.269861 V[A^3]= 166.02561792 T[K]= 4041916 P[GPa]= 4249.300 18.400 E[Ha]= 160.64900000 1.07400000
f= Al N= 1 rho[g/cc]= 0.269861 V[A^3]= 166.02561792 T[K]= 8083831 P[GPa]= 9208.000 31.500 E[Ha]= 513.26500000 1.80900000
What I've tried doing is:
Al = pd.read_csv('Al_EOS_09-18-20.txt', skiprows=18, delimiter='=', names=['f', 'N', 'rho[g/cc]', 'V[A^3]', 'T[K]', 'P[GPa]', 'E[Ha]'])
What this returns is a dataframe with the correct columns, but the values under each column contain the value and the name of the next column. So under Al['f'] I get 'Al N' instead of just 'Al'.
Any help would be GREATLY appreciated!