import numpy as np
import pandas as pd
test = pd.read_csv("Test_3.txt", sep="\t", header=0, decimal=",")
data = np.array(test)
make_float = np.vectorize(float)
data = make_float(data)
print(data)
результат:
(env3) XYZ@delya:~/Py/tmp$ python codenp.py
[[ -3.50000000e-06 3.36000000e+00]
[ -3.49900000e-06 3.36000000e+00]
[ -3.49800000e-06 3.36000000e+00]
...,
[ 3.49700000e-06 0.00000000e+00]
[ 3.49800000e-06 0.00000000e+00]
[ 3.49900000e-06 -8.00000000e-02]]
поправка :
import numpy as np
import pandas as pd
test = pd.read_csv("Test_3.txt", sep="\t", header=0, decimal=",")
data = np.array(test)
print(data)
не треба переводити у флоат окремою векторизацією.
результат аналогічний:
[[ -3.50000000e-06 3.36000000e+00]
[ -3.49900000e-06 3.36000000e+00]
[ -3.49800000e-06 3.36000000e+00]
...,
[ 3.49700000e-06 0.00000000e+00]
[ 3.49800000e-06 0.00000000e+00]
[ 3.49900000e-06 -8.00000000e-02]]