[Numpy-discussion] Proposal: add ndarray.keys() to return dtype.names

Stephan Hoyer shoyer at gmail.com
Tue Sep 30 14:05:21 EDT 2014


I like this idea. But I am -1 on returning None if the array is
unstructured. I expect .keys(), if present, to always return an iterable.

In fact, this would break some of my existing code, which checks for the
existence of "keys" as a way to do duck typed checks for dictionary like
objects (e.g., including pandas.DataFrame):
https://github.com/xray/xray/blob/v0.3/xray/core/utils.py#L165
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140930/b7cfcd7d/attachment.html>


More information about the NumPy-Discussion mailing list