python - interpolate values between sample years with Pandas -



python - interpolate values between sample years with Pandas -

i'm trying interpolated values metric shown below using pandas time series.

test.csv

year,metric 2020,290.72 2025,221.763 2030,152.806 2035,154.016

code

import pandas pd df = pd.read_csv('test.csv', parse_dates={'timestamp': ['year']}, index_col='timestamp')

as far understand gives me time series jan 1 of each year index. need fill in values missing years (2021, 2022, 2023, 2024, 2026 etc)

is there way pandas?

if you're using newer version of pandas, dataframe object should have interpolate method can used fill in gaps.

python pandas time-series

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -