I'm trying to write a program in python which doesn't need to use extra packages like numpy and scipy. In one part of the project, if I can interpolate a function to a set of data, I can save processing time. Is there a way to fit a function to a set of data with built-in functions of python only?
Yes a way there is. You must implement a interpolation what you do by hand when interpolate. There are different method, for example Lagrangian interpolation or Barycentric Lagrange Interpolation. This is an argument cover in all the books of numerical analysis for university level. Oblivious you will use the pit hon data structures and so on, but is possible.
Now I agree with @AntonMenshov, I do not think it is the best way. To be honest install numpy and scipy are these two lines:
pip install numpy pip install scipy
Eventually I suggest to consider to write an your package that hide numpy and scipy and the interface/api for the final user is oriented to your specific case. Think your package as a sort of Domain Specific Language. In this way your user have got an api more near they needs, but with a strong (and more tested) back-end.
When you built your package you can indicate the dependency, you can find the python documentation, so the you lunch pip install my_package it will install the dependency indicated.