{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/11409","labels_url":"https://api.github.com/repos/pydata/pandas/issues/11409/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/11409/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/11409/events","html_url":"https://github.com/pydata/pandas/issues/11409","id":112790984,"number":11409,"title":"Non consistent behavior with Dataframe.sum","user":{"login":"Tux1","id":6661307,"avatar_url":"https://avatars.githubusercontent.com/u/6661307?v=3","gravatar_id":"","url":"https://api.github.com/users/Tux1","html_url":"https://github.com/Tux1","followers_url":"https://api.github.com/users/Tux1/followers","following_url":"https://api.github.com/users/Tux1/following{/other_user}","gists_url":"https://api.github.com/users/Tux1/gists{/gist_id}","starred_url":"https://api.github.com/users/Tux1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tux1/subscriptions","organizations_url":"https://api.github.com/users/Tux1/orgs","repos_url":"https://api.github.com/users/Tux1/repos","events_url":"https://api.github.com/users/Tux1/events{/privacy}","received_events_url":"https://api.github.com/users/Tux1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Numeric","name":"Numeric","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-22T12:19:33Z","updated_at":"2015-10-22T14:45:42Z","closed_at":"2015-10-22T12:35:04Z","body":"Hello,\r\n\r\nI noticed a strange behavior involving important errors in my scripts.\r\n```python\r\na = pd.DataFrame(np.nan, index=[1,2], columns=[3,4]).astype(np.float64)\r\nb = pd.DataFrame(np.nan, index=[1,2], columns=[3,4]).astype(np.float32)\r\nc = pd.DataFrame(np.nan, index=[1,2], columns=[3,4])\r\nd = pd.DataFrame(index=[1,2], columns=[3,4])\r\n\r\nprint(a.sum())\r\n3    0\r\n4    0\r\ndtype: float64\r\nprint(b.sum())\r\n3   NaN\r\n4   NaN\r\ndtype: float64\r\nprint(c.sum())\r\n3    0\r\n4    0\r\ndtype: float64\r\nprint(d.sum())\r\n3   NaN\r\n4   NaN\r\ndtype: float64\r\n```\r\n\r\nAccording to your doc, the right result should be the second and fourth output. \r\nI guess it is due to Numpy changes 0.18. However I want to point out that numpy's choice is not good. A sum of NaN must not be zero. \r\n\r\nFirst argument is about logic : Nothing + Nothing is not something but Nothing + object could be something. Two things which are not number can not be a number by arithmetic operation\r\n\r\nSecond argument : it's easy to fill the result with zeros if you don't want NaN values. \r\n```python\r\na = pd.DataFrame(np.nan, index=[1,2], columns=[3,4]).sum()\r\na.fillna(0, inplace=0)\r\n```\r\nWhereas you are not able to fill the result with NaN instead of zeros into NaN rows (or columns whatever..) if they have been filled with zeros before (easily). I hope you see \r\nwhat I mean...\r\n\r\nThanks for your work ;)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/150248178","html_url":"https://github.com/pydata/pandas/issues/11409#issuecomment-150248178","issue_url":"https://api.github.com/repos/pydata/pandas/issues/11409","id":150248178,"user":{"login":"Tux1","id":6661307,"avatar_url":"https://avatars.githubusercontent.com/u/6661307?v=3","gravatar_id":"","url":"https://api.github.com/users/Tux1","html_url":"https://github.com/Tux1","followers_url":"https://api.github.com/users/Tux1/followers","following_url":"https://api.github.com/users/Tux1/following{/other_user}","gists_url":"https://api.github.com/users/Tux1/gists{/gist_id}","starred_url":"https://api.github.com/users/Tux1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tux1/subscriptions","organizations_url":"https://api.github.com/users/Tux1/orgs","repos_url":"https://api.github.com/users/Tux1/repos","events_url":"https://api.github.com/users/Tux1/events{/privacy}","received_events_url":"https://api.github.com/users/Tux1/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T14:45:42Z","updated_at":"2015-10-22T14:45:42Z","body":"The difference of behaviour between float32 and float64 is also due to bottleneck ? "}}