How to interpolate values with Pandas

1 min readDataFramePandasData ManipulationData
7-Day Challenge

Land Your First Data Science Job

A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.

Build portfolios that hiring managers love
Master the Python and SQL essentials to be industry-ready
Practice with real interview questions from tech companies
Access to the $100k/y Data Scientist Cheatsheet

Join thousands of developers who transformed their careers through our challenge. Unsubscribe anytime.

The Pandas library will give you the tools to fill the NaN values.

One of its methods, DataFrame.interpolate() can be used to interpolate NaN values.

Interpolation is a way to estimate the values in between two known values.

Linear Interpolation - Source wikipedia
Polynomial Interpolation - Source wikipedia

Here the blue line gives an interpolation in between red dots.

Or so it estimates what can of value it could potentially be.

DataFrame.interpolate() can receive few arguments, but the most important for us today is the method argument.

The method argument will specify what kind of method we want to use, as shown in the two graphs above.

It can accept wide range of methods shown in the following :

interpolation method that can be used by DataFrame.interpolate

Here you are ! You now know how to interpolate values using pandas interpolate method.

7-Day Challenge

Land Your First Data Science Job

A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.

Build portfolios that hiring managers love
Master the Python and SQL essentials to be industry-ready
Practice with real interview questions from tech companies
Access to the $100k/y Data Scientist Cheatsheet

Join thousands of developers who transformed their careers through our challenge. Unsubscribe anytime.

Free Newsletter

Master Data Science in Days, Not Months 🚀

Skip the theoretical rabbit holes. Get practical data science skills delivered in bite-sized lessons – Approach used by real data scientist. Not bookworms. 📚

Weekly simple and practical lessons
Access to ready to use code examples
Skip the math, focus on results
Learn while drinking your coffee

By subscribing, you agree to receive our newsletter. You can unsubscribe at any time.