def numpy_2darray_fromstring(s, nrows=1, dtype=float):
    chunk_size = len(s) / nrows
return numpy.array([numpy.fromstring(s[i * chunk_size:(i + 1) * chunk_size],
    dtype=dtype) for i in range(nrows)])
How to restore a 2-dimensional numpy.array from a bytestring?