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