0

I have two csv files ,where I plot two series using the matplotlib in python.

File 1.csv

0.1,2
1.2,3
2.1,1
3.2,4
4.1,3
5.3,6
6.2,5
7.5,3
8.3,2
9.4,6

File 2.csv:

0.2,3
1.1,3.2
2.0,1.3
3.1,4.4
4.3,3.5
5.2,6.1
6.2,5.5
7.4,3.6
8.1,2.5
9.2,6.7

and I got the graph like below, enter image description here

Can I get the difference in between the two series in the graph to a file for every time stamp like below.

1 sec : 0
2 sec : 0.5
3 sec : 0.4

I do not have any idea for getting these things to a file..

Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75
vijay
  • 151
  • 1
  • 1
  • 8
  • 2
    Your question is very unclear. (1) Your data points are not aligned, so how do you plan on finding the value at, for example, 1 sec? Interpolation? and (2) at 1 sec, the difference is not 0, but seems closer to 0.2, contrary to your expected output. Please reformulate your question if you want helpful answers – Diziet Asahi Aug 28 '17 at 13:21
  • If data points are aligned I can get the difference directly from csv files. But here I need the difference in approximate? – vijay Aug 28 '17 at 13:26
  • Interpolate the values from one of the lines: https://docs.scipy.org/doc/numpy/reference/generated/numpy.interp.html or https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html – Joe Aug 28 '17 at 13:40

0 Answers0