common_index 是 8783,Series[common_index] 是 8784,这怎么可能?
common_index is size 8783 and Series[common_index] is 8784, how is this even possible?
common_index 是一个长度为 8783 的 DatetimeIndex
当我用它来过滤像这样的 Series[common_index] 的 Series 对象时,我得到一个 8784 大小的 Series 对象。
怎么可能?
是的,如果对 select 使用重复值是可能的:
s = pd.Series(range(3), index=[0,1,5])
print (s[[0,1,0,5,5,5]])
0 0
1 1
0 0
5 2
5 2
5 2
dtype: int64
print (pd.unique([0,1,0,5,5,5]))
[0 1 5]
print (s[pd.unique([0,1,0,5,5,5])])
0 0
1 1
5 2
dtype: int64
common_index 是一个长度为 8783 的 DatetimeIndex 当我用它来过滤像这样的 Series[common_index] 的 Series 对象时,我得到一个 8784 大小的 Series 对象。
怎么可能?
是的,如果对 select 使用重复值是可能的:
s = pd.Series(range(3), index=[0,1,5])
print (s[[0,1,0,5,5,5]])
0 0
1 1
0 0
5 2
5 2
5 2
dtype: int64
print (pd.unique([0,1,0,5,5,5]))
[0 1 5]
print (s[pd.unique([0,1,0,5,5,5])])
0 0
1 1
5 2
dtype: int64