{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/19577","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19577/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19577/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19577/events","html_url":"https://github.com/pandas-dev/pandas/issues/19577","id":295203502,"number":19577,"title":"ExtensionArray Ops discussion","user":{"login":"TomAugspurger","id":1312546,"avatar_url":"https://avatars3.githubusercontent.com/u/1312546?v=4","gravatar_id":"","url":"https://api.github.com/users/TomAugspurger","html_url":"https://github.com/TomAugspurger","followers_url":"https://api.github.com/users/TomAugspurger/followers","following_url":"https://api.github.com/users/TomAugspurger/following{/other_user}","gists_url":"https://api.github.com/users/TomAugspurger/gists{/gist_id}","starred_url":"https://api.github.com/users/TomAugspurger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomAugspurger/subscriptions","organizations_url":"https://api.github.com/users/TomAugspurger/orgs","repos_url":"https://api.github.com/users/TomAugspurger/repos","events_url":"https://api.github.com/users/TomAugspurger/events{/privacy}","received_events_url":"https://api.github.com/users/TomAugspurger/received_events","type":"User","site_admin":false},"labels":[{"id":35818298,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/API%20Design","name":"API Design","color":"AD7FA8","default":false},{"id":47223669,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Numeric","name":"Numeric","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/pandas-dev/pandas/milestones/53","html_url":"https://github.com/pandas-dev/pandas/milestone/53","labels_url":"https://api.github.com/repos/pandas-dev/pandas/milestones/53/labels","id":2853937,"number":53,"title":"0.23.0","description":"after 0.22","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":110,"closed_issues":819,"state":"open","created_at":"2017-10-20T10:17:09Z","updated_at":"2018-02-07T17:42:40Z","due_on":"2018-03-31T07:00:00Z","closed_at":null},"comments":0,"created_at":"2018-02-07T16:28:57Z","updated_at":"2018-02-07T22:12:01Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Split from https://github.com/pandas-dev/pandas/pull/19520\r\n\r\nHow to handle things like `__eq__`, `__add__`, etc.\r\n\r\nNeither the Python 2 or Python 3 object defaults are appropriate, so I think we should make it abstract or provide a default implementation for some / all of these.\r\n\r\nWe should be able to do a default implementation for the simple case of binop(extension_array, extension_array) by\r\n\r\n- masking nulls in either self | other\r\n- cast self / other to ndarrays\r\n- compare and apply null mask\r\n\r\n@jorisvandenbossche raises the point that for some extension arrays, casting to an object ndarray can be expensive. It'd be unfortunate to do the casting if we're just going to raise a `TypeError` when the `binop` is done. In this case the subclass will need to override all those ops (or we could add class attribute like `_comparable` and check that before doing `__eq__` or `__lt__`, etc).\r\n\r\nHow much coercion do we want to attempt? I would vote to stay simple and only attempt a comparison if\r\n\r\n    other is an instance of the same ExtensionArray type\r\n    other is a scalar of self.dtype.type.\r\n\r\nOtherwise we return NotImplemented. Subclasses can of course choose more or less aggressive coercion rules.\r\n\r\nWhen boxed in a `Series` or `Index`, I think the goal should be\r\n\r\n1. dispatch to the underlying `.values` comparsion\r\n2. Reconstruct the appropriate output (box in series / index with name)."},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/363928520","html_url":"https://github.com/pandas-dev/pandas/issues/19577#issuecomment-363928520","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19577","id":363928520,"user":{"login":"jbrockmendel","id":8078968,"avatar_url":"https://avatars1.githubusercontent.com/u/8078968?v=4","gravatar_id":"","url":"https://api.github.com/users/jbrockmendel","html_url":"https://github.com/jbrockmendel","followers_url":"https://api.github.com/users/jbrockmendel/followers","following_url":"https://api.github.com/users/jbrockmendel/following{/other_user}","gists_url":"https://api.github.com/users/jbrockmendel/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrockmendel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrockmendel/subscriptions","organizations_url":"https://api.github.com/users/jbrockmendel/orgs","repos_url":"https://api.github.com/users/jbrockmendel/repos","events_url":"https://api.github.com/users/jbrockmendel/events{/privacy}","received_events_url":"https://api.github.com/users/jbrockmendel/received_events","type":"User","site_admin":false},"created_at":"2018-02-07T22:12:01Z","updated_at":"2018-02-07T22:12:01Z","author_association":"CONTRIBUTOR","body":"Migrated from #19520:\r\n\r\n> A thorny issue: What to do with comparison methods\r\n\r\nI've been planning on moving the Index/Series arithmetic/comparison ops into Array subclasses, so that `Series.__op__(other)` could just wrap `self._data.blocks[0].__op__(other)` and we get consistency between Series/DataFrame ops for free.\r\n\r\nMost of the comparison ops are ready to make that jump; I can prioritize it if getting that done quickly will help you out.\r\n\r\nOne caveat I'm concerned about is that the existing implementations in the Index subclasses have gotten tangled up with a bunch of unrelated Index machinery. Ideally I'd like these operations to go into self-contained mixin classes that rely on constructor methods, but are independent of slicing/concat/reindex/dropna/... mentioned above."}}
{"actor":{"display_login":"jbrockmendel"}}