Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: Respect print options in masked array formatting #28698

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from

Conversation

VascoConceicao
Copy link

Previously, the string representation of masked arrays did not honor global print options such as floatmode, precision, and suppress. This led to inconsistencies between the display of masked and unmasked arrays.
This update addresses the issue by:

  • Utilizing np.array2string to format the underlying data, ensuring consistency with global print settings.
  • Replacing masked elements with the masked_print_option string ('--' by default) while preserving formatting for visible elements.
  • Maintaining support for legacy formatting options, including truncation with ellipsis (...) when legacy='1.13' is set. (Fixes BUG: print options not respected for masked arrays. #28685)

Maybe a bit overkill :)

@VascoConceicao VascoConceicao force-pushed the bugfix/maskedarray-printoptions branch from f5da334 to 7353323 Compare April 13, 2025 15:29
@jorenham jorenham added the component: numpy.ma masked arrays label May 1, 2025
@VascoConceicao VascoConceicao force-pushed the bugfix/maskedarray-printoptions branch 5 times, most recently from 43c2dcf to 7faa07e Compare May 9, 2025 12:38
Previously, the string representation of masked arrays did not honor
global print options such as floatmode, precision, and suppress.
This led to inconsistencies between the display of masked and
unmasked arrays.
This update addresses the issue by:
– Utilizing np.array2string to format the underlying data, ensuring
  consistency with global print settings.
– Replacing masked elements with the masked_print_option string
  ('--' by default) while preserving formatting for visible elements.
– Maintaining support for legacy formatting options, including
  truncation with ellipsis (...) when legacy='1.13' is set.
(Fixes numpy#28685)
@VascoConceicao VascoConceicao force-pushed the bugfix/maskedarray-printoptions branch from 02c1692 to a97d2da Compare May 16, 2025 20:23
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.

BUG: print options not respected for masked arrays.
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.