Python: Finding period of a two column data

Viewed 1538

This question seems so trivial but I didn't find any suitable answer so I am asking!

Lets say I have a two column data(say, {x, sin(x)} )

X Y(X) 0.0 0.0 0.1 0.099 0.2 0.1986

How do I find the period of the function Y(X);

I have some experience in Mathematica where(roughly)

  1. I just interpolate the data as a function say y(x), then

  2. Calculate y'(x) and set y'(x_p)=0;

  3. collect all (x_p+1 - x_p)'s and take average to get the period.

In python, however I am stuck after step 1 as I can find out x_p for a particular guess value but not all the x_p's. Also this procedure doesn't seem very elegant to me. Is there a better way to do things in python?

1 Answers
Related