{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/19653","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19653/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19653/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19653/events","html_url":"https://github.com/pandas-dev/pandas/issues/19653","id":296303271,"number":19653,"title":"DOC: Clarifiy fill_value behavior in arithmetic ops","user":{"login":"HagaiHargil","id":17546299,"avatar_url":"https://avatars3.githubusercontent.com/u/17546299?v=4","gravatar_id":"","url":"https://api.github.com/users/HagaiHargil","html_url":"https://github.com/HagaiHargil","followers_url":"https://api.github.com/users/HagaiHargil/followers","following_url":"https://api.github.com/users/HagaiHargil/following{/other_user}","gists_url":"https://api.github.com/users/HagaiHargil/gists{/gist_id}","starred_url":"https://api.github.com/users/HagaiHargil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HagaiHargil/subscriptions","organizations_url":"https://api.github.com/users/HagaiHargil/orgs","repos_url":"https://api.github.com/users/HagaiHargil/repos","events_url":"https://api.github.com/users/HagaiHargil/events{/privacy}","received_events_url":"https://api.github.com/users/HagaiHargil/received_events","type":"User","site_admin":false},"labels":[{"id":134699,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Docs","name":"Docs","color":"3465A4","default":false},{"id":195648009,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Effort%20Low","name":"Effort Low","color":"006b75","default":false},{"id":2822342,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Missing-data","name":"Missing-data","color":"d7e102","default":false},{"id":47223669,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Numeric","name":"Numeric","color":"006b75","default":false},{"id":34444536,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Usage%20Question","name":"Usage Question","color":"0052cc","default":false},{"id":717120670,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/good%20first%20issue","name":"good first issue","color":"0e8a16","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/pandas-dev/pandas/milestones/32","html_url":"https://github.com/pandas-dev/pandas/milestone/32","labels_url":"https://api.github.com/repos/pandas-dev/pandas/milestones/32/labels","id":933188,"number":32,"title":"Next Major Release","description":"Changes that would be nice to have in the next release. These issues are not blocking. They will be pushed to the next release if no one has time to fix them.","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":1329,"closed_issues":255,"state":"open","created_at":"2015-01-13T10:53:19Z","updated_at":"2018-02-12T18:52:14Z","due_on":"2018-08-31T07:00:00Z","closed_at":null},"comments":8,"created_at":"2018-02-12T09:03:15Z","updated_at":"2018-02-12T23:44:55Z","closed_at":null,"author_association":"NONE","body":"When adding two DataFrames using `df1.add(df2)` one can use the `fill_value` parameter to fill in any NaNs that might come up. This parameter seems pretty broken:\r\n\r\n```python\r\na = pd.DataFrame(np.ones((3, 2)))\r\nb = pd.DataFrame(np.ones((4, 3)))\r\nprint(a + b)  # all good:\r\n#      0    1   2\r\n# 0  2.0  2.0 NaN\r\n# 1  2.0  2.0 NaN\r\n# 2  2.0  2.0 NaN\r\n# 3  NaN  NaN NaN\r\n\r\nprint(a.add(b))  # all good\r\nprint(a.add(b, fill_value=0))  # broken\r\n#      0    1    2\r\n# 0  2.0  2.0  1.0\r\n# 1  2.0  2.0  1.0\r\n# 2  2.0  2.0  1.0\r\n# 3  1.0  1.0  1.0\r\n```\r\nAs you see, it filled the NaNs with `1.0`. Changing `fill_value=1` will fill everything with `2.0`. However, changing some of the values inside `b` leads to more peculiar results, and I couldn't really connect the dots and find some pattern.\r\n\r\nThis was observed on Python 3.6 on both Linux and Windows.\r\n\r\nThanks.\r\n\r\n<details>\r\n```\r\ncommit: None\r\npython: 3.6.3.final.0\r\npython-bits: 64\r\nOS: Linux\r\nOS-release: 3.10.0-514.el7.x86_64\r\nmachine: x86_64\r\nprocessor: x86_64\r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_US.UTF-8\r\nLOCALE: en_US.UTF-8\r\npandas: 0.22.0\r\npytest: None\r\npip: 9.0.1\r\nsetuptools: 38.4.0\r\nCython: 0.27.3\r\nnumpy: 1.14.0\r\nscipy: 1.0.0\r\npyarrow: None\r\nxarray: None\r\nIPython: 6.2.1\r\nsphinx: 1.6.7\r\npatsy: None\r\ndateutil: 2.6.1\r\npytz: 2017.3\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nfeather: None\r\nmatplotlib: 2.1.1\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: None\r\nhtml5lib: 0.9999999\r\nsqlalchemy: None\r\npymysql: None\r\npsycopg2: None\r\njinja2: 2.10\r\ns3fs: None\r\nfastparquet: None\r\npandas_gbq: None\r\npandas_datareader: None\r\n```\r\n</details>"},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/365102059","html_url":"https://github.com/pandas-dev/pandas/issues/19653#issuecomment-365102059","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19653","id":365102059,"user":{"login":"ZhuBaohe","id":35796307,"avatar_url":"https://avatars2.githubusercontent.com/u/35796307?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhuBaohe","html_url":"https://github.com/ZhuBaohe","followers_url":"https://api.github.com/users/ZhuBaohe/followers","following_url":"https://api.github.com/users/ZhuBaohe/following{/other_user}","gists_url":"https://api.github.com/users/ZhuBaohe/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhuBaohe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhuBaohe/subscriptions","organizations_url":"https://api.github.com/users/ZhuBaohe/orgs","repos_url":"https://api.github.com/users/ZhuBaohe/repos","events_url":"https://api.github.com/users/ZhuBaohe/events{/privacy}","received_events_url":"https://api.github.com/users/ZhuBaohe/received_events","type":"User","site_admin":false},"created_at":"2018-02-12T23:44:55Z","updated_at":"2018-02-12T23:44:55Z","author_association":"NONE","body":"> DataFrame.add(other, axis=’columns’, level=None, fill_value=None)\r\n>     Addition of dataframe and other, element-wise (binary operator add).\r\n>     Equivalent to dataframe + other, but with support to substitute a fill_value for missing data _**in one\r\n> of the inputs**_.\r\n\r\nI think the document is clear."}}
{"actor":{"display_login":"ZhuBaohe"}}