UFuncTypeError: ufunc ‘add’ did not contain a loop with signature matching types (dtype(’<U32’), dtype(’<U32’)) -> dtype(’<U32’)
It seems like line[0], line[1], line[2], line[3] are elements of dist_hist. dict_hist is a numpy.ndarray. The elements of dict_hist has a numeric type (like np.float64) (based on calculations from your attached file). You’re trying to add elements of different types: np.float64 and str. If you want to avoid this TypeError, you can change type of line[0], line[1], line[2], line[3] to str.
保存不同类型的数据的list不能直接相加,要转化为相同的数据类型后即可