'How to get the minimum from two Pandas Series?
I would like to select the minimum values from two Pandas Series with the same index, how can I do that ?
s1 = pd.Series({'ABC': 0.2, 'XYZ': 1})
s2 = pd.Series({'ABC': 2, 'XYZ': 0.3})
Desired output would be :
ABC 0.2
XYZ 0.3
dtype: float64
The Series can have 2 or more rows.
Solution 1:[1]
I found the answer to my own question.
s3 = s1.append(s2).groupby(level=0).min()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Florent |
