Min « List « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » List » Min 

1. Fast way to get N Min or Max elements from a list in Python    stackoverflow.com

I currently have a long list which is being sorted using a lambda function f. I then choose a random element from the first five elements. Something like:

f = lambda x: ...

2. Getting the index of the returned max or min item using max()/min() on a list    stackoverflow.com

I'm using Python's max and min functions on lists for a minimax algorithm, and I need the index of the value returned by max() or min(). In other words, I need ...

3. Python - Minimum of a List of Instance Variables    stackoverflow.com

I'm new to Python and I really love the min function.

>>>min([1,3,15])
0
But what if I have a list of instances, and they all have a variable named number?
class Instance():
    ...

4. Python: Find the min, max value in a list    stackoverflow.com

alist = [(1,3),(2,5),(2,4),(7,5)]
I need to get the min max value for each position in tuple. Fox example: The exepected output of alist is
min_x = 1
max_x = 7

min_y = 3
max_y = 5
Is there ...

5. Python: Get max pair in a list of pairs with min y    stackoverflow.com

How i get max pair in a list of pairs with min y? I got this list:

L =[[1,3],[2,5],[-4,0],[2,1],[0,9]]
With max(L) i get [2,5], but i want [2,1].

6. Problem: How to read a minimum value in the list consisting of objects?    stackoverflow.com

How can I read the minimum value of "price" parameter in the "room_options" list, with n elements of the list. Each list item is an instance of Room class:

room_options: (list)
  ...

7. Python min function with a list of objects    stackoverflow.com

How can use the key argument for the min function to compare a list of objects's 1 attribute? Example

class SpecialNumber:
    def __init__(self, i):
       ...

8. PYTHON problem with negative decimals    stackoverflow.com

I have a list of negative floats. I want to make a histogram with them. As far as I know, Python can't do operations with negative numbers. Is this correct? The ...

9. Minimum and maximum of the last 1000 values of the changing list    stackoverflow.com

I'm creating an iterative algorithm (Monte Carlo method). The algorithm returns a value on every iteration, creating a stream of values. I need to analyze these values and stop the algorithm when say ...

10. min() function and lists    python-forum.org

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.