Grant Edwards <grant.b.edwa...@gmail.com> wrote: > On 2024-02-16, Chris Green via Python-list <python-list@python.org> wrote: > > > I'm looking for a simple way to make NaN values output as something > > like '-' or even just a space instead of the string 'nan'. > > It would probably help if you told us how you're "outputting" them now > (the Python feaatures/functions used, not the actual output format). > > Are you using f-strings, the % operator, str.format(), or ?? > > I would be tempted to try monkey-patching the float class to override > the __format__ method. I have no idea what side effects that might > have, or if it's even used by the various formatting mechanisms, so > you might end up scraping bits off the walls... > It's using f'{...}' at the moment.
-- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list