Issue
I have two (larger than the toy example) Series e.g.:
s1 = pd.read_json('{"count":{"1614470400000":4,"1617148800000":0,"1619740800000":0,"1622419200000":4,"1625011200000":4,"1627689600000":5,"1630368000000":0,"1632960000000":8,"1635638400000":2}}')['count']
s2 = pd.read_json('{"count":{"1625011200000":1}}')['count']
What would be an efficient way to add them? I can imagine creating a join, then adding ignoring nans, but I think this should be slower than some operation that would merge sort them?
Here is the desired result for the toy example:
Solution
Try with Series.add(...) using the parameter fill_value=0
out = s1.add(s2,fill_value=0)
count
2019-06-30 1.0
2021-02-28 4.0
2021-03-31 0.0
2021-04-30 0.0
2021-05-31 4.0
2021-06-30 4.0
2021-07-31 5.0
2021-08-31 0.0
2021-09-30 8.0
2021-10-31 2.0
Answered By - BENY
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.