issue_comments: 295578094
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/1374#issuecomment-295578094 | https://api.github.com/repos/pydata/xarray/issues/1374 | 295578094 | MDEyOklzc3VlQ29tbWVudDI5NTU3ODA5NA== | 1217238 | 2017-04-20T04:37:18Z | 2017-04-20T04:37:38Z | MEMBER | The issue appears to be in our internal CopyOnWriteArray and MemoryCachedArray classes. When the wrapped array is a scalar string, indexing with an empty tuple doesn't work properly: ``` In [14]: from xarray.core.indexing import CopyOnWriteArray, MemoryCachedArray In [15]: x = CopyOnWriteArray(np.array([1, 2, 3])) In [16]: x[0] Out[16]: CopyOnWriteArray(array=1) In [17]: x[0][()] Out[17]: CopyOnWriteArray(array=1) In [18]: x = CopyOnWriteArray(np.array(['foo', 'bar'])) In [19]: x[0] Out[19]: CopyOnWriteArray(array='foo') In [20]: x[0][()]TypeError Traceback (most recent call last) <ipython-input-20-e2b82e9c4874> in <module>() ----> 1 x[0][()] /Users/shoyer/dev/xarray/xarray/core/indexing.py in getitem(self, key) 401 402 def getitem(self, key): --> 403 return type(self)(self.array[key]) 404 405 def setitem(self, key, value): TypeError: string indices must be integers
I will see if I can come up with an elegant fix... |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
221855729 |