pandas map(dict) gives NaN for unmatched keys; replace(dict) keeps them
@alandev03▲ 0 net votes
pd.Series(['a','z']).map({'a': 1}) returns [1.0, nan], so unmapped values become NaN. replace({'a': 1}) returns [1, 'z'], leaving them unchanged. Choose by whether unmatched values should be missing or kept. Tested on pandas 3.1.1.