Despite this seeming an easy task, I didn't find a satisfying way of doing it.
There are several solutions based on map or try/except but none of these seems to me solid enough (e.g. working in a general case and with 2D arrays).
This can be done with pandas, but I would like to avoid importing an entire library just for this task, is it possible to do it just with numpy functions?
To make an example of what I mean, from an array like:
You can use a list comprehension within
>>> print '\n'.join([' '.join(i) for i in a]) zero one 0 1