Home > Net >  How to convert this text file into panda tables to make plots?
How to convert this text file into panda tables to make plots?

Time:03-02

Here is an image of the text file:

enter image description here

CodePudding user response:

Try using pd.read_csv and some parameters:

df = pd.read_csv('data.csv', skiprows=3, header=None, sep='\s ', comment=',', 
                 names=['z', 'tz', 'tL', 'DA', 'DL'])
print(df)

# Output
       z    tz   tL     DA     DL
0  0.001  13.3  0.1   42.3   43.2
1  0.100  12.2  1.3  380.4  460.3

Content of data.csv:

;###
Omegavac
;;;;
0.001 13.3  0.1 42.3  43.2,,,,
0.1 12.2  1.3 380.4 460.3,,,,
  • Related