Reputation: 1053
Want to only use the first email if multiple are added. Made a function which looks for ',', if it finds it, displays a message and returns the first email.
For a strange reason, it seems to loop through the dataframe twice when using 'applymap', because it prints the message twice.
When I use the 'apply' function on the series, it -as expected-prints out once. Any idea why is this discrepancy?
Upvotes: 0
Views: 194
Reputation: 3306
From the documentation, version 0.25.0, I quote :
Notes
In the current implementation applymap calls func twice on the first column/row to decide whether it can take a fast or slow code path. This can lead to unexpected behavior if func has side-effects, as they will take effect twice for the first column/row.
Upvotes: 1