superset-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [incubator-superset] betodealmeida commented on issue #8253: Fix array casting
Date Wed, 18 Sep 2019 21:30:52 GMT
betodealmeida commented on issue #8253: Fix array casting
   > 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:
   >>> 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
   If we use "object", though:
   >>> 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:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message