[Pandas-dev] [pydata] Feedback request for return value of empty or all-NA sum (0 or NA?)

Nathaniel Smith njs at pobox.com
Mon Dec 4 17:17:50 EST 2017


On Mon, Dec 4, 2017 at 9:12 AM, Wes McKinney <wesmckinn at gmail.com> wrote:
>> If I understand correctly, you have in mind a replacement for groupby
> such that obj.REPLACEMENT(a_categorical).sum() will have NaN for non-
> observed categories
>
> No, I am proposing to add a new aggregation method (an alternative to
> "sum"). So something like
>
> s.groupby(...).total()
>
> or
>
> s.groupby(...).null_sum()
>
> (names are hard)

Another spelling to consider would be something like sum(skipna="if_any_valid")

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Pandas-dev mailing list