Skip to content
Advertisement

Combine two pandas Series with overlap into one column

Let us say I have two Pandas series A and B that I wish to combine into one series. I want to set the values of overlapping rows to 0 (or some other arbitrary value).

JavaScript

Into

JavaScript

How would I go about doing this in pandas.

Advertisement

Answer

We can do concat then check the dup index , drop reindex back

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement