I am having trouble finding a way to do an efficient element-wise minimum of two Series objects in pandas. For example I can add two Series easily enough:
In
You can concat the dataframes and take the minimum, specifying level=0:
level=0
>>> s1 = pd.Series(data=[1,1,1], index=[1,2,3]) >>> s2 = pd.Series(data=[1,2,2,1], index=[1,2,3,4]) >>> pd.concat([s1, s2]).min(level=0) 1 1 2 1 3 1 4 1 dtype: int64
This approach also works on dataframes.