Answer:
Edit 1: As requested, here is the rest of the code to the function.
with open(file_path, 'r') as f:
result = [tuple(map(int, line.split())) for line in f]
for i in range(len(result)):
for j in range(len(result[i])):
result[i][j] = (result[i][j] - min(result[i])) / (max(result[i]) - min(result[i]))
result[i] = np.array(result[i])
print(result)
I have edited the code to use int()
but it still doesn't seem to work.
Edit 2: It works now. Thank you everyone for helping me!
A:
int('0.0')
raises a TypeError
because int()
cannot convert strings that do not contain only whole numbers (without decimals). float()
can convert these strings to floats.
int('1.0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int() argument must be a string, a bytes-like object or a number, not 'float'
High Frequency Noise in Solving Differential Equations
When solving differential equations, high…
Troubleshooting SMS Code Not Coming from Pyrogram for New Accounts
Pyrogram is a popular Python …
Solving Partial Differential Equations with Spectral Methods using `solve_ivp`
The `solve_ivp` f…