Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我可以在所有情况下都使用idxmax()而不是argmax()吗?_Python_Pandas_Numpy - Fatal编程技术网

Python 我可以在所有情况下都使用idxmax()而不是argmax()吗?

Python 我可以在所有情况下都使用idxmax()而不是argmax()吗?,python,pandas,numpy,Python,Pandas,Numpy,我发现idxmax()在argmax()不起作用的情况下(例如在整个数据帧上)可以工作,但是在某些情况下我需要argmax()?如果没有,我将把它从我的脑海中抹去。idxmax()和argmax()之间没有太大区别。普通的idxmax相当于nanargmax idxmax是一个函数,因此它可以接受sereis和dataframe 如果在dataframe上有更多的numpy操作,并且您正在dataframe内使用numpy数组,则使用argmax() # code from git axi

我发现
idxmax()
argmax()
不起作用的情况下(例如在整个数据帧上)可以工作,但是在某些情况下我需要
argmax()
?如果没有,我将把它从我的脑海中抹去。
idxmax()
argmax()
之间没有太大区别。普通的
idxmax
相当于
nanargmax

idxmax
是一个函数,因此它可以接受sereis和dataframe

如果在dataframe上有更多的numpy操作,并且您正在dataframe内使用numpy数组,则使用
argmax()

 # code from git 
 axis = self._get_axis_number(axis)
 indices = nanops.nanargmax(self.values, axis=axis, skipna=skipna)