Skip to content

Commit e747c16

Browse files
Fix: Change None values to NaN in combine_first method for better handling of missing data
1 parent 5829e3e commit e747c16

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/core/series.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,6 +3223,14 @@ def combine_first(self, other) -> Series:
32233223
dtype: float64
32243224
"""
32253225
from pandas.core.reshape.concat import concat
3226+
3227+
# Change None values to NaN for both Series
3228+
def replace_none_with_nan(series):
3229+
series.fillna(value=np.nan, inplace=True)
3230+
3231+
# Apply the function to both Series
3232+
replace_none_with_nan(self)
3233+
replace_none_with_nan(other) # Removed the extra parenthesis here
32263234

32273235
if self.dtype == other.dtype:
32283236
if self.index.equals(other.index):

0 commit comments

Comments
 (0)