MCPcopy
hub / github.com/pandas-dev/pandas / _wrap_na_result

Method _wrap_na_result

pandas/core/arrays/masked.py:1568–1585  ·  view source on GitHub ↗
(self, *, name, axis, mask_size)

Source from the content-addressed store, hash-verified

1566 return result
1567
1568 def _wrap_na_result(self, *, name, axis, mask_size):
1569 mask = np.ones(mask_size, dtype=bool)
1570
1571 float_dtyp = "float32" if self.dtype == "Float32" else "float64"
1572 if name in ["mean", "median", "var", "std", "skew", "kurt", "sem"]:
1573 np_dtype = float_dtyp
1574 elif name in ["min", "max"] or self.dtype.itemsize == 8:
1575 np_dtype = self.dtype.numpy_dtype.name
1576 else:
1577 is_windows_or_32bit = is_platform_windows() or not IS64
1578 int_dtyp = "int32" if is_windows_or_32bit else "int64"
1579 uint_dtyp = "uint32" if is_windows_or_32bit else "uint64"
1580 np_dtype = {"b": int_dtyp, "i": int_dtyp, "u": uint_dtyp, "f": float_dtyp}[
1581 self.dtype.kind
1582 ]
1583
1584 value = np.array([1], dtype=np_dtype)
1585 return self._maybe_mask_result(value, mask=mask)
1586
1587 def _wrap_min_count_reduction_result(
1588 self, name: str, result, *, skipna, min_count, axis

Callers 1

_reduceMethod · 0.95

Calls 3

_maybe_mask_resultMethod · 0.95
is_platform_windowsFunction · 0.90
arrayMethod · 0.45

Tested by

no test coverage detected