Q:

How to compute the derivative of a curve?

Sorry for the naivety of the question, my field is not mathematics. I am writing a script to calculate the derivative of a curve given by a set of (x,y) points as
(x,y)
1,3
2,2
3,7
4,7
5,8
6,12

I calculate the dy/dx for each point from the slope over a unit of x as y(n+1)-y(n) to produce
(x,dy/dx)
2,-1
3,5
4,0
5,1
6,4

Is it mathematically correct? Do I calculate dy/dx correctly?
The given curve is not a mathematical function but an empirical set of data (say x=time, y=temperature). Is it the correct way to calculate the dy/dx for the available set of data?
EDIT: Probably, it is meaningless to calculate the slope between two given points. Instead, it is better to draw a curve based on the best fit. Then, we will have a better approximation of the data points where the slope at each point is meaningful.
Am I right? Should I recalculate the y values based on a best-fit approximation before trying to calculate the slope? 

A:

The way to do this is to fit a cubic spline through the data, and then calculate the derivative.
See scipy.interpolate.CubicSpline
Then use the .Derivative() method to get what you want.

