Use applymap instead of np.vectorize
Replace numpy.vectorize, which is faster, but has its limitations: 1. it supports maximum of 32 columns (ValueError: Cannot construct a ufunc with more than 32 operands) 2. it samples the first row of each columns for the type and if that's an np.nan, it will force float for the whole column. 3. #2 can be turned off by manually giving the otypes, but it might fail on some types, like datetime: TypeError: Cannot interpret 'datetime64[ns, UTC]' as a data type