- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 19.2k
Description
Pandas version checks
- 
I have checked that this issue has not already been reported. 
- 
I have confirmed this bug exists on the latest version of pandas. 
- 
I have confirmed this bug exists on the main branch of pandas. 
Reproducible Example
import pandas as pd
s1 = pd.Series([None, None, None], index=['a', 'b', 'c'])
s2 = pd.Series([None, None, None], index=['b', 'c', 'd'])
result = s1.combine_first(s2)
print(result)Issue Description
The documentation of Series.combine_first states:
Update null elements with value in the same location in ‘other’.
In the above example, s2 doesn't provide any value at index 'a', so combine_first should not affect this index.
However, the result with pandas 2.2.2 is the following, which unexpectedly changes the value at 'a' from None to NaN:
a     NaN
b    None
c    None
d    None
dtype: object
Pandas 2.1.4 behaves as expected, so this looks like a regression.
The behavior was changed with this PR: #57034
Expected Behavior
The expected output is:
a    None
b    None
c    None
d    None
dtype: object
Installed Versions
pandas                : 2.2.0rc0+28.g6dbeeb4009
numpy                 : 1.26.4
pytz                  : 2024.1
dateutil              : 2.9.0.post0
setuptools            : 63.2.0
pip                   : 24.0
Cython                : 3.0.10
pytest                : 8.2.0
hypothesis            : 6.100.2
sphinx                : 7.3.7
blosc                 : None
feather               : None
xlsxwriter            : 3.2.0
lxml.etree            : 5.2.1
html5lib              : 1.1
pymysql               : 1.4.6
psycopg2              : 2.9.9
jinja2                : 3.1.3
IPython               : 8.24.0
pandas_datareader     : None
adbc-driver-postgresql: None
adbc-driver-sqlite    : None
bs4                   : 4.12.3
bottleneck            : 1.3.8
fastparquet           : 2024.2.0
fsspec                : 2024.3.1
gcsfs                 : 2024.3.1
matplotlib            : 3.8.4
numba                 : 0.59.1
numexpr               : 2.10.0
odfpy                 : None
openpyxl              : 3.1.2
pyarrow               : 16.0.0
pyreadstat            : 1.2.7
python-calamine       : None
pyxlsb                : 1.0.10
s3fs                  : 2024.3.1
scipy                 : 1.13.0
sqlalchemy            : 2.0.29
tables                : 3.9.2
tabulate              : 0.9.0
xarray                : 2024.3.0
xlrd                  : 2.0.1
zstandard             : 0.22.0
tzdata                : 2024.1
qtpy                  : None
pyqt5                 : None