Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get column index of maximum value in each row pandas

>>> df.idxmax(axis=1)
0    Communications
1          Business
2    Communications
3    Communications
4          Business
dtype: object
Comment

maximum element in dataframe row

max_elements = df.max(axis = 1) #axis = 0, default, max of each column
print(max_elements)
Comment

pd df index for the maximum value in each row

df.idxmin()
Comment

PREVIOUS NEXT
Code Example
Python :: polish notation python 
Python :: functools reduce python 
Python :: no module named googlesearch 
Python :: how to username in python? 
Python :: sum along axis python 
Python :: deleting a file using python 
Python :: taille du liste python 
Python :: extract bigrams python 
Python :: python to make video 
Python :: how to change todays date formate in python 
Python :: django data from many to many field in template 
Python :: SyntaxError: positional argument follows keyword argument 
Python :: pytorch version python command 
Python :: tkinter frameless window 
Python :: how to change values of dictionary in python 
Python :: form action in django 
Python :: python turn off garbage collection 
Python :: (models.W042) Auto-created primary key 
Python :: Rectangle with python 
Python :: sort by the frequency of occurrences in Python 
Python :: specific mail.search python UNSEEN SINCE T 
Python :: replace characters in string python 
Python :: how to make a random int in python 
Python :: send serial commands in python 
Python :: decode utf8 whit python 
Python :: solidity compiler for python 
Python :: get all different element of both list python 
Python :: how to pick everything after a character in python 
Python :: open file dialog on button click pyqt5 
Python :: print example in python 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =