idxmin(self, axis: 'Axis' = 0, skipna: 'bool' = True) -> 'Series'
NA/null values are excluded.
This method is the DataFrame version of ndarray.argmin
.
The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
Exclude NA/null values. If an entire row/column is NA, the result will be NA.
If the row/column is empty
Indexes of minima along the specified axis.
Return index of first occurrence of minimum over requested axis.
Series.idxmin
Return index of the minimum element.
Consider a dataset containing food consumption in Argentina.
This example is valid syntax, but we were not able to check execution>>> df = pd.DataFrame({'consumption': [10.51, 103.11, 55.48],This example is valid syntax, but we were not able to check execution
... '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.
This example is valid syntax, but we were not able to check execution>>> 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: objectSee :
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.core.series.Series.idxmin
pandas.core.generic.NDFrame._add_numeric_operations.<locals>.min
pandas.core.generic.NDFrame._add_numeric_operations.<locals>.prod
pandas.core.generic.NDFrame._add_numeric_operations.<locals>.sum
pandas.core.generic.NDFrame._add_numeric_operations.<locals>.max
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them