[Tutor] CSV Read

Giulia Marcoux giulia.marcoux at gmail.com
Mon Jun 25 15:35:22 EDT 2018


Hello,

I am a student learning python, and i am running into some difficulties. I
am tryign to read a csv file that has different delimiters for different
rows: Example:

Format:V1.1
Model: R
Step Size: 10mm
Distance: 10cm
Gain: 1000

X,Y
1,3
2,5
6,5
5,7

For the X,Y data, I have no problem getting it into the right cells,
however I cannot separate the values after the colon for the first few
rows. Its either one or the other. I am using pandas to read my CSV file.
So far I have:

d=pd.read_csv('read.csv',delimiter=',',skiprows=0)

When I replace the delimiter for ':', it no longer works, and if i put
sep=',|:' it does not work either. In the end I need to plot the x,y values
and i will need some of the info in the rows above like the gain to
manipulate the y data. If you have any tips for me I would be very grateful!

Thanks,
Giulia


More information about the Tutor mailing list