Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: When dividing elements of matrix i would like the result 0 instead of inf?
Post: RE: 0 instead of inf

(Jul-22-2019, 11:19 AM)DeaD_EyE Wrote: You have to do this after the calculation. I think I did: import numpy as np np.savetxt("result.txt", np.divide(np.loadtxt("1.txt"), np.loadtxt("2.txt"))) m1, ...
Koczkodan Data Science 4 1,648 Jul-22-2019, 11:40 AM
    Thread: When dividing elements of matrix i would like the result 0 instead of inf?
Post: RE: 0 instead of inf

(Jul-22-2019, 09:41 AM)scidam Wrote: It is normal that division by zero yields infinity, i.e. inf (floating point). However, you can change all infs to zeros, e.g. result[np.isinf(result)] = 0.0 st...
Koczkodan Data Science 4 1,648 Jul-22-2019, 10:21 AM
    Thread: When dividing elements of matrix i would like the result 0 instead of inf?
Post: When dividing elements of matrix i would like the ...

Hi, While dividing element from first matrix by second matrix value 0 I need result to be 0 instead of inf. example: 1 1 2 6 divided by 1 0 4 3 should be 1 0(now got inf) 0,5 2 import numpy as...
Koczkodan Data Science 4 1,648 Jul-22-2019, 08:14 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020