python - Np.Argwhere To Produce Numbers -


i working on price weighted indexes class , although simple calculation hand figured practice novice python skills.

edit code working now

stockbprice = np.array([35.1, 45.6, 41.5, 47.8]) stockcprice = np.array([52, 67.6, 61.5, 67.7]) stockdprice = np.array([89.5, 107.4, 53.7, 64.4])  quantityb = np.array([300,300,300,300]) quantityc = np.array([400,400,400,400]) quantityd = np.array([100,100,200,200])  pricearray = [] in range(0,1):     if np.argwhere(stockbprice) < 2:       pricearray.append((stockbprice+stockcprice+stockdprice)/3)     else:       d = (stockbprice[2]+stockcprice[2]+stockdprice[2])/((stockbprice[1]+stockcprice[1]+stockdprice[1])/float(3.0))       pricearray.append((stockbprice+stockcprice+stockdprice)/d)  pricearray = np.array(pricearray) print pricearray 

i want use indices condition np.argwhere gives boolean general idea want use.

very easy

if len(stockbprice) < 2: 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -