79252589

Date: 2024-12-04 20:16:51
Score: 2
Natty:
Report link

I found delim_whitespace and astype(float) to be working. Is this what you are looking for?

data_Test = pd.read_csv("TestData.txt", header=None, delim_whitespace=True)
data_Test = data_Test.astype(float)
print("TestData (first 5 rows):\n", data_Test[:5])

Output

    0     1     2
0   7.9   0.60  0.060
1   7.5   0.50  0.036
2   7.8   0.61  0.029
3   8.5   0.28  0.056
4   8.1   0.56  0.028

TestData.txt

7.9000000e+00   6.0000000e-01  6.0000000e-02
7.5000000e+00    5.0000000e-01   3.6000000e-02
7.8000000e+00    6.1000000e-01   2.9000000e-02
8.5000000e+00    2.8000000e-01   5.6000000e-02
8.1000000e+00    5.6000000e-01   2.8000000e-02
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Dauinh