python - select the rows that satisfy the same condition on all columns -


I have an array of data named d (79000,17) . I am thinking that there is a way to write a short loop or a function, in which to select a condition in all the columns, only to select the rows, where they satisfy the same position on the column, for example If a loop is the condition for the column i , d [:, i] & lt; 99?

If you want a flexible select function which supports all the conditions (your status also), So you can use the code below. You want to apply my_filter (). Select

  def (list_of_rows, filter_function): result = [] list_of_rows for row: if filter_function (line): result.append (row) return result def My_filter (line): If the line [ 2] & gt; 10: return true return false my_list = [(1, 4, 7), (2, 9, 12), (4, 2, 20), (10, 20, 30), (3, 2, 1)] result = Choose (my_list, my_filter) print result    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -