Skip to content

Behavior of sum and infinity #968

Closed
Closed
@craustin

Description

@craustin

import numpy as np
from pandas import Series
a = [np.nan, 1]
b = [np.inf, 1]
print Series(a).sum() #1
print Series(b).sum() #2
print np.sum(a) #3
print np.sum(b) #4

I understand that pandas has made the design decision that sums with nans will drop nans (#1), but why is infinity dropped in the same way? I don't see why np.inf + 5 could reasonably be 5. numpy returns np.inf in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions