Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add bfill functionality to numpy._core #26496

Closed
wants to merge 1 commit into from
Closed

Conversation

iquelli
Copy link
Contributor

@iquelli iquelli commented May 21, 2024

Relates to #25823.

  • Implement backward fill functionality to fill NaN values using the next valid value along the specified axis.
  • Add tests to ensure bfill works correctly for 1D and 2D arrays.
  • Update documentation to include examples and usage guidelines for the new bfill method.

Backward fill is useful in many data preprocessing tasks where missing values need to be filled with
the next available data point.

Examples
--------
>>> a = np.array([None, 2])
>>> a.bfill(axis=0)
>>> a
array([2, 2])
>>> a = np.array([[None, 2], [1, 1]])
>>> a.bfill(axis=1)
>>> a
array([[1, 2], [1, 1]])
>>> a = np.array([[None, 2], [1, 1]])
>>> a.bfill()
>>> a
array([[2, 2], [1, 1]])

Co-authored-by: @goncalobarias

Relates to numpy#25823.

- Implement backward fill functionality to fill
  NaN values using the next valid value along
  the specified axis.
- Add tests to ensure bfill works correctly for
  1D and 2D arrays.
- Update documentation to include examples and
  usage guidelines for the new bfill method.

Backward fill is useful in many data preprocessing
tasks where missing values need to be filled with
the next available data point.

Co-authored-by: Gonçalo Bárias <goncalo.barias@tecnico.ulisboa.pt>
@ngoldbaum
Copy link
Member

Probably not worth spending a bunch of time debugging before the discussion stabilizes on the mailing list, but the address sanitizer test failure is a heap buffer overflow in the C code added in this PR.

By the way, we have biweekly community meetings on zoom if you'd like to drop by to discuss this effort face-to-face.

@mattip
Copy link
Member

mattip commented May 30, 2024

I will close this for now, the discussion on the mailing list and the issue point to bottleneck as a better home for this. Please reopen or open a new PR (that passes sanitizer tests) if the consensus changes.

@mattip mattip closed this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants