Skip to content

Conversation

anishkarki
Copy link
Contributor

@anishkarki anishkarki commented Nov 8, 2024

This PR improves the documentation for the DataFrame.interpolate() method and closes #60227

The focus is on providing more precise descriptions and examples for the following method options:

  • method="index": Emphasized that this method uses the actual numerical values of the index, which is particularly useful for non-sequential or time-based indices.
  • method="time": Expanded on the description to specify that this method interpolates based on the time intervals between observations, suitable for data with a time-based index.
  • method="values": Clarified that this method performs interpolation based on the actual numerical values within the DataFrame, treating them as equally spaced along the index.

Changes Made

  • Enhanced the docstring descriptions for values, index, and time methods in DataFrame.interpolate().
  • Added a practical example using a DataFrame with a non-sequential index to demonstrate the difference between method="linear" and method="index".

@rhshadrach rhshadrach added Docs Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Nov 8, 2024
@anishkarki
Copy link
Contributor Author

@rhshadrach Could you review this PR to improve documentation for df.interpolate() methods as part of issue #60227?”

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I see no difference between "actual numeric values" and "numeric values", so I think "actual" can be removed.

anishkarki and others added 6 commits November 11, 2024 00:07
Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com>
Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com>
@anishkarki
Copy link
Contributor Author

@rhshadrach I've made the requested changes to the documentation. Could you please review it again? Thanks!

@anishkarki anishkarki closed this Nov 12, 2024
@anishkarki anishkarki reopened this Nov 12, 2024
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rhshadrach rhshadrach added this to the 3.0 milestone Nov 12, 2024
@mroeschke mroeschke merged commit 73da90c into pandas-dev:main Nov 12, 2024
56 of 90 checks passed
@mroeschke
Copy link
Member

Thanks @anishkarki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: Improve documentation df.interpolate() for methods ‘time’, ‘index’ and ‘values’
3 participants