Skip to main content

Function collection for handling integers with NaNs.

Project description

GitHub Workflow CI Status Supported Versions PyPI Code style: black

intnan

Integer data types lack special values for -inf, inf and NaN. Especially NaN as an indication for missing data would be useful in many scientific contexts.

Of course there is numpy.ma.MaskedArray around for the very same reason. Nevertheless, it might sometimes be annoying to carry a separate mask array around. And in those cases, using a set of numpy-compatible functions for the same job will do just fine.

This package provides such an implementation for several standard numpy functions, that treat integer arrays in such a way, that the lowest negative integer resembles NaN.

The library provides an implementation using only standard numpy functions and another implementation using numba, for functions that allow major speed gains. The numba implementation is automatically selected, when it is available for import.

functions

The following list of functions is provided by intnan.

  • nanval(x)
  • isnan(x)
  • fix_invalid(x, copy=True, fill_value=0)
  • asfloat(x)
  • anynan(x)
  • allnan(x)
  • nanmax(x)
  • nanmin(x)
  • nanmaximum(x, y)
  • nanminimum(x, y)
  • nansum(x)
  • nanprod(x)
  • nancumsum(x)
  • nanmean(x)
  • nanvar(x, ddof=0)
  • nanstd(x, ddof=0)
  • nanequal(x, y)
  • nanclose(x, y, delta=sys.float_info.epsilon)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intnan-0.2.1.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distribution

intnan-0.2.1-py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page