| 662 | |
| 663 | @derived_from(np) |
| 664 | def nanvar( |
| 665 | a, axis=None, dtype=None, keepdims=False, ddof=0, split_every=None, out=None |
| 666 | ): |
| 667 | if dtype is not None: |
| 668 | dt = dtype |
| 669 | else: |
| 670 | dt = getattr(np.var(np.ones(shape=(1,), dtype=a.dtype)), "dtype", object) |
| 671 | |
| 672 | implicit_complex_dtype = dtype is None and np.iscomplexobj(a) |
| 673 | |
| 674 | return reduction( |
| 675 | a, |
| 676 | partial( |
| 677 | moment_chunk, |
| 678 | sum=chunk.nansum, |
| 679 | numel=nannumel, |
| 680 | implicit_complex_dtype=implicit_complex_dtype, |
| 681 | ), |
| 682 | partial(moment_agg, sum=np.sum, ddof=ddof), |
| 683 | axis=axis, |
| 684 | keepdims=keepdims, |
| 685 | dtype=dt, |
| 686 | split_every=split_every, |
| 687 | combine=partial(moment_combine, sum=np.nansum), |
| 688 | out=out, |
| 689 | concatenate=False, |
| 690 | ) |
| 691 | |
| 692 | |
| 693 | def _sqrt(a): |