xorbits.pandas.DataFrame.idxmin#
- DataFrame.idxmin(axis: Axis = 0, skipna: bool = True, numeric_only: bool = False) Series [源代码]#
Return index of first occurrence of minimum over requested axis.
NA/null values are excluded.
- 参数
axis ({0 or 'index', 1 or 'columns'}, default 0) – The axis to use. 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise.
skipna (bool, default True) – Exclude NA/null values. If an entire row/column is NA, the result will be NA.
numeric_only (bool, default False) –
Include only float, int or boolean data.
1.5.0(pandas) 新版功能.
- 返回
Indexes of minima along the specified axis.
- 返回类型
- 引发
ValueError –
If the row/column is empty
参见
Series.idxmin
Return index of the minimum element.
提示
This method is the DataFrame version of
ndarray.argmin
.实际案例
Consider a dataset containing food consumption in Argentina.
>>> df = pd.DataFrame({'consumption': [10.51, 103.11, 55.48], ... 'co2_emissions': [37.2, 19.66, 1712]}, ... index=['Pork', 'Wheat Products', 'Beef'])
>>> df consumption co2_emissions Pork 10.51 37.20 Wheat Products 103.11 19.66 Beef 55.48 1712.00
By default, it returns the index for the minimum value in each column.
>>> df.idxmin() consumption Pork co2_emissions Wheat Products dtype: object
To return the index for the minimum value in each row, use
axis="columns"
.>>> df.idxmin(axis="columns") Pork consumption Wheat Products co2_emissions Beef consumption dtype: object
警告
This method has not been implemented yet. Xorbits will try to execute it with pandas.
This docstring was copied from pandas.core.frame.DataFrame.