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 to know which move produced the max (at a first player's turn) or min (second player) value.
f...

Asked By Kevin Griffin

I have a dictionary: keys are strings, values are integers.
Example:
stats = {'a':1000, 'b':3000, 'c': 100}
I'd like to get 'b' as an answer, since it's the key with a higher value.
I did the following, using an intermediate list with reversed key-v...

Asked By ricafeal

NumPy proposes a way to get the index of the maximum value of an array via np.argmax.
I would like a similar thing, but returning the indexes of the N maximum values.
For instance, if I have an array, [1, 3, 2, 4, 5], function(array, n=3) would return t...

Asked By Alexis Métaireau

I think the maximum integer in python is available by calling sys.maxint.
What is the maximum float or long in Python?

Asked By ladyfafa

How to find the maximum of 2 numbers?
value = -9999
run = problem.getscore()
I need to compare the 2 values i.e value and run and find the maximum of 2. I need some python function to operate it?

Asked By Shilpa

I have the following recursion code, at each node I call sql query to get the nodes belong to the parent node.
here is the error:
Exception RuntimeError: 'maximum recursion depth exceeded' in <bound method DictCursor.__del__ of <MySQLdb.cursors....

Asked By add-semi-colons

I have a 2 dimensional NumPy array. I know how to get the maximum values over axes:
>>> a = array([[1,2,3],[4,3,1]])
>>> amax(a,axis=0)
array([4, 3, 3])
How can I get the indices of the maximum elements? So I would like as output arra...

Asked By Peter Smit

I have a list:
a = [32, 37, 28, 30, 37, 25, 27, 24, 35, 55, 23, 31, 55, 21, 40, 18, 50,
35, 41, 49, 37, 19, 40, 41, 31]
max element is 55 (two elements on position 9 and 12)
I need to find on which position(s) the maximum value is situate...

Asked By Bob

data = {'name' : ['bill', 'joe', 'steve'],
'test1' : [85, 75, 85],
'test2' : [35, 45, 83],
'test3' : [51, 61, 45]}
frame = pd.DataFrame(data)
I would like to add a new column that shows the max value for each row.
desired output:
name te...

Asked By user2333196

How do I find all rows in a pandas dataframe which have the max value for count column, after grouping by ['Sp','Mt'] columns?
Example 1: the following dataFrame, which I group by ['Sp','Mt']:
Sp Mt Value count
0 MM1 S1 a **3**
1 MM1 S...

Asked By jojo12

How do I find all rows in a pandas dataframe which have the max value for count column, after grouping by ['Sp','Mt'] columns?
Example 1: the following dataFrame, which I group by ['Sp','Mt']:
Sp Mt Value count
0 MM1 S1 a **3**
1 MM1 S...

Asked By jojo12

data = {'name' : ['bill', 'joe', 'steve'],
'test1' : [85, 75, 85],
'test2' : [35, 45, 83],
'test3' : [51, 61, 45]}
frame = pd.DataFrame(data)
I would like to add a new column that shows the max value for each row.
desired output:
name te...

Asked By user2333196

I am trying to get the max value from a panda dataframe as whole. I am not interested in what row or column it came from. I am just interested in a single max value within the dataframe.
Here is my dataframe:
df = pd.DataFrame({'group1': ['a','a','a','b...

Asked By Boosted_d16

I have a Pandas DataFrame with a mix of screen names, tweets, fav's etc. I want find the max value of 'favcount' (which i have already done) and also return the screen name of that 'tweet'
df = pd.DataFrame()
df['timestamp'] = timestamp
df['sn'] = sn
df...

Asked By mGarsteck

I have a DataFrame like this one:
In [7]:
frame.head()
Out[7]:
Communications and Search Business General Lifestyle
0 0.745763 0.050847 0.118644 0.084746
0 0.333333 0.000000 0.583333 0.083333
0 0.617021 0.042553 0.29787...

Asked By markov zain

I have a DataFrame like this one:
In [7]:
frame.head()
Out[7]:
Communications and Search Business General Lifestyle
0 0.745763 0.050847 0.118644 0.084746
0 0.333333 0.000000 0.583333 0.083333
0 0.617021 0.042553 0.29787...

Asked By markov zain

My question is in two connected parts:
How do I calculate the max along a certain axis of a tensor? For example, if I have
x = tf.constant([[1,220,55],[4,3,-1]])
I want something like
x_max = tf.max(x, axis=1)
print sess.run(x_max)
output: [220,4]...

Asked By aphdstudent

My question is in two connected parts:
How do I calculate the max along a certain axis of a tensor? For example, if I have
x = tf.constant([[1,220,55],[4,3,-1]])
I want something like
x_max = tf.max(x, axis=1)
print sess.run(x_max)
output: [220,4]...

Asked By aphdstudent

This is my dataframe df
a b c
1.2 2 0.1
2.1 1.1 3.2
0.2 1.9 8.8
3.3 7.8 0.12
I'm trying to get max value from each row of a dataframe, I m expecting output like this
max_value
2
3.2
8.8
7.8
This is what I have tried
...

Asked By deepesh