issue_comments: 326157538
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | performed_via_github_app | issue |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/pydata/xarray/issues/1537#issuecomment-326157538 | https://api.github.com/repos/pydata/xarray/issues/1537 | 326157538 | MDEyOklzc3VlQ29tbWVudDMyNjE1NzUzOA== | 1217238 | 2017-08-31T00:44:41Z | 2017-08-31T00:44:41Z | MEMBER | OK, here we go: ``` In [25]: class GoodWrappedArray(object): ...: def init(self, array): ...: self.array = array ...: def array(self, dtype=None): ...: return np.asarray(self.array, dtype) ...: def getitem(self, key): ...: return self.array[key] ...: def len(self): ...: return len(self.array) ...: In [26]: ind = GoodWrappedArray(np.array([True, False, True])) In [27]: np.arange(3)[ind] Out[27]: array([0, 2]) In [28]: class BadWrappedArray(object): ...: def init(self, array): ...: self.array = array ...: def array(self, dtype=None): ...: return np.asarray(self.array, dtype) ...: def getitem(self, key): ...: return BadWrappedArray(self.array[key]) ...: def len(self): ...: return len(self.array) ...: In [29]: ind = BadWrappedArray(np.array([True, False, True])) In [30]: np.arange(3)[ind] Out[32]: array([], shape=(0, 3), dtype=int64) ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
253975242 |