BUG: check if object provides len() before trying to iterate it

some libraries want object arrays from objects that are iterable but
rely on not providing len() to get the right dtype from numpy.
closes gh-5100