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/2609#issuecomment-447835252,https://api.github.com/repos/pydata/xarray/issues/2609,447835252,MDEyOklzc3VlQ29tbWVudDQ0NzgzNTI1Mg==,630936,2018-12-17T12:51:29Z,2018-12-17T12:51:29Z,CONTRIBUTOR,Thanks for the confirmation @shoyer !,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,391398977
https://github.com/pydata/xarray/issues/553#issuecomment-334799819,https://api.github.com/repos/pydata/xarray/issues/553,334799819,MDEyOklzc3VlQ29tbWVudDMzNDc5OTgxOQ==,630936,2017-10-06T16:09:25Z,2017-10-06T16:09:25Z,CONTRIBUTOR,"@shoyer Aww, great. Thanks for pointing this out.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,103703011
https://github.com/pydata/xarray/issues/553#issuecomment-334799284,https://api.github.com/repos/pydata/xarray/issues/553,334799284,MDEyOklzc3VlQ29tbWVudDMzNDc5OTI4NA==,630936,2017-10-06T16:07:18Z,2017-10-06T16:08:37Z,CONTRIBUTOR,"There is an open issue at numpy about this in https://github.com/numpy/numpy/issues/6266
Also, for future reference, locally re-defining `np.angle` by removing the `z = array(z)` line from the [official function](https://github.com/numpy/numpy/blob/v1.13.0/numpy/lib/function_base.py#L2072-L2115) appears to work well enough as a workaround, assuming the input is an xarray,
```py
import numpy.core.numeric as _nx
def angle(z, deg=0):
""""""Compute the angle of an xarray
Parameters
----------
z : array_like
A complex number or sequence of complex numbers.
deg : bool, optional
Return angle in degrees if True, radians if False (default).
Returns
-------
angle : ndarray or scalar
The counterclockwise angle from the positive real axis on
the complex plane, with dtype as numpy.float64.
See: https://github.com/pydata/xarray/issues/553
https://github.com/numpy/numpy/blob/v1.13.0/numpy/lib/function_base.py#L2072-L2115
""""""
if deg:
fact = 180/pi
else:
fact = 1.0
if (issubclass(z.dtype.type, _nx.complexfloating)):
zimag = z.imag
zreal = z.real
else:
zimag = 0
zreal = z
return np.arctan2(zimag, zreal)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,103703011
https://github.com/pydata/xarray/issues/1375#issuecomment-326803603,https://api.github.com/repos/pydata/xarray/issues/1375,326803603,MDEyOklzc3VlQ29tbWVudDMyNjgwMzYwMw==,630936,2017-09-03T13:01:44Z,2017-09-03T13:01:44Z,CONTRIBUTOR,"> do you have an application that we could use to drive this?
Other examples where labeled sparse arrays would be useful are,
* [one-hot encoding](https://rasbt.github.io/mlxtend/user_guide/preprocessing/one-hot_encoding/) that are widely used in machine learning.
* [tokenizing textual data](http://scikit-learn.org/stable/modules/feature_extraction.html#common-vectorizer-usage) produces large sparse matrices where the column labels correspond to the vocabulary, while row labels correspond to document ids. Here is a minimal example using scikit-learn,
```py
import os.path
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
ds = fetch_20newsgroups()
vect = CountVectorizer()
X = vect.fit_transform(ds.data)
print(X) # Extracted tokens
# Returns:
# <11314x130107 sparse matrix of type ''
# with 1787565 stored elements in Compressed Sparse Row format>
column_labels = vect.get_feature_names()
print(np.asarray(column_labels))
# Returns:
# array(['00', '000', '0000', ..., 'íålittin', 'ñaustin', 'ýé'], dtype='