我想创建“niv”(这里是数据帧……但numpy矢量2D适合我)。。。这个循环非常慢
for d in range(1, 10000000):
niv = cash[testmp.index[d] == cash.index.date]
.......
我想用np.where()
np.where((cash_np[0:,0:1]==testmp_np[0:,0:1]),cash_np,0)
但我无法比较。。。。因为第一列返回的对象不同
下面是“现金”的示例
cash_np=cash.reset_index().values
cash_np[0:1,0:1]
Out[]:array([[Timestamp('2012-02-21 08:01:00')]], dtype=object)
我想用这个。。。但是不起作用
cash_np[0:1,0:1].date()
而对于“testmp”:
testmp_np=testmp.reset_index().values
testmp_np[0:1,0:1]
Out[]:array([[datetime.date(2012, 2, 22)]], dtype=object)
我想用这个。。。但是不起作用
cash_np[0:1,0:1].date()
但这是可行的
t = pd.Timestamp('2013-12-25 00:00:00')
t.date()
Out[]:datetime.date(2013, 12, 25)
我不知道该怎么办
问候
SR70
目前没有回答
相关问题 更多 >
编程相关推荐