【发布时间】:2021-06-03 15:19:43
【问题描述】:
将binary function 应用于两个Pandas Series elementwise 的推荐方法是什么,当它们具有相同的索引时将值配对在一起,并在其中一个系列缺少值时提供填充值?
例如,输入系列sl 和sr 应该产生输出系列so:
sl = Pandas Series
index,value
a,1
b,4
c,5
e,7
sr = Pandas Series
index,value
a,2
b,3
d,6
e,7
so = binary_func(sl, sr, fill_value=0)
index,value
a,binary_func(1,2)
b,binary_func(4,3)
c,binary_func(5,0)
d,binary_func(0,6)
e,binary_func(7,7)
【问题讨论】:
标签: python python-3.x pandas series