如何从列表中求出特定数量的数字

2024-09-28 22:24:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我想从一个列表中总结出一个特定数量的数字

openBids = df_1['openBid'] 
mean = np.mean(openBids) 
std = np.std(openBids) 
rets = np.log(openBids / openBids.shift(1)) 
rets.dropna() 
round(sum(rets.dropna()), 4) # here i only want to add together the first ten numbers from the list for example

有人能告诉我怎么做吗

谨致问候

马塞尔


Tags: thelogdf列表数量shiftnp数字