betodealmeida commented on issue #8253: Fix array casting URL: https://github.com/apache/incubator-superset/pull/8253#issuecomment-532874901 > what are the cases where they would not be the same type? is that suggestive of a bigger issue? > > otherwise, LGTM @DiggidyDave, we're casting the results from the DB — a list of tuples — into a Numpy array so we can address each column efficiently: ```python >>> data = [("a", 1), ("b", 10)] >>> np.array(data) array([['a', '1'], ['b', '10']], dtype='<U2') >>> np.array(data)[:,0] # first column array(['a', 'b'], dtype='<U2') >>> np.array(data)[:,1] # second column array(['1', '10'], dtype='<U2') ``` Note that the numbers were cast to unicode, since that's the common type between int and unicode. If we use "object", though: ```python >>> np.array(data, dtype='object') array([['a', 1], ['b', 10]], dtype=object) ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org