Skip to content
Advertisement

Find line number of a value which matches upto 2 decimal in python numpy

I tried to find the line number of value which is 60 % of the maximum value in file.

JavaScript

My file looks like this,

JavaScript

Now I print the line number of the max value by

JavaScript

now how to find the line number which has 0.60 just comparing up to two decimal value only in python.

Advertisement

Answer

This will find the element closest to the 60% mark:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement