Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:15:30+00:00 2026-06-03T07:15:30+00:00

I have a DataFrame, say a volatility surface with index as time and column

  • 0

I have a DataFrame, say a volatility surface with index as time and column as strike. How do I do two dimensional interpolation? I can reindex but how do i deal with NaN? I know we can fillna(method='pad') but it is not even linear interpolation. Is there a way we can plug in our own method to do interpolation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:15:32+00:00Added an answer on June 3, 2026 at 7:15 am

    You can use DataFrame.interpolate to get a linear interpolation.

    In : df = pandas.DataFrame(numpy.random.randn(5,3), index=['a','c','d','e','g'])
    
    In : df
    Out:
              0         1         2
    a -1.987879 -2.028572  0.024493
    c  2.092605 -1.429537  0.204811
    d  0.767215  1.077814  0.565666
    e -1.027733  1.330702 -0.490780
    g -1.632493  0.938456  0.492695
    
    In : df2 = df.reindex(['a','b','c','d','e','f','g'])
    
    In : df2
    Out:
              0         1         2
    a -1.987879 -2.028572  0.024493
    b       NaN       NaN       NaN
    c  2.092605 -1.429537  0.204811
    d  0.767215  1.077814  0.565666
    e -1.027733  1.330702 -0.490780
    f       NaN       NaN       NaN
    g -1.632493  0.938456  0.492695
    
    In : df2.interpolate()
    Out:
              0         1         2
    a -1.987879 -2.028572  0.024493
    b  0.052363 -1.729055  0.114652
    c  2.092605 -1.429537  0.204811
    d  0.767215  1.077814  0.565666
    e -1.027733  1.330702 -0.490780
    f -1.330113  1.134579  0.000958
    g -1.632493  0.938456  0.492695
    

    For anything more complex, you need to roll-out your own function that will deal with a Series object and fill NaN values as you like and return another Series object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pandas DataFrame with a date column. It is not an index.
Say I have a dataframe df with two or more columns, is there an
I have data frame with two column say a and b now I want
I have a dataframe with a column of integers that I would like to
I have a dataframe and would like to add a new column where the
I have a dataframe with one column that I would like to split into
Let's say I have two data frames. Each has a DAY, a MONTH, and
I have two data.frames. For examples sake let's say they look like this: df1
Say I have a dataframe source <- data.frame(ID=c(1,2), COUNT=c(3,4)) that looks like this: ID
Lets say I have a data frame with two variables x & y and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.