You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In tests.frame.test_arithmetic we test the DataFrame part of the following, but we do not test the Series behavior (at least not in that file)
arr = np.array([np.nan, 1, 6, np.nan])
arr2 = np.array([2j, np.nan, 7, None])
ser = pd.Series(arr)
ser2 = pd.Series(arr2)
df = pd.DataFrame(ser)
df2 = pd.DataFrame(ser2)
ser < ser2 # raises TypeError, makes sense
df < df2 # raises TypeError, makes sense
ser.lt(ser2) # raises TypeError, makes sense
>>> df.lt(df2)
0
0 False
1 False
2 True
3 False
The df.lt(df2) version (the "flex" op) masks positions where either df or df2 is null. That is fine, but why doesn't the Series version do the same thing?
The text was updated successfully, but these errors were encountered:
a) make Series.lt behave like DataFrame.lt
b) make DataFrame.lt behave like Series.lt
The main argument for a) is that it is less breaking for users relying on the DataFrame behavior.
The main argument for b) is that the behavior only matters in exactly 1 test, and it is a test with truly weird complex-dtype behavior (#28050)
OK, I'm not sure what's best here. My inclination is to follow NumPy where possible, which I think argues for option a, right? (I'm ignoring the None, which forces object dtype. Maybe I shouldn't ignore that).
In tests.frame.test_arithmetic we test the DataFrame part of the following, but we do not test the Series behavior (at least not in that file)
The
df.lt(df2)
version (the "flex" op) masks positions where eitherdf
ordf2
is null. That is fine, but why doesn't theSeries
version do the same thing?The text was updated successfully, but these errors were encountered: