Python processes the index of the csv file to get several lists, and then wants to find its value in a column from the original csv file for index according to the elements in the list.

tmp saves the csv information, as shown in the following figure
clipboard.png
and then sorts it by the size of F1:

score = tmp ["f1"] .order ()
score.head ()
len (score)

then divide the whole data 5 equally:

df = {}
close = tmp ["close"]
port1 = list (score.index) [: len (score) / / 5]
port2 = list (score.index) [len (score) / / 5: 2*len (score) / / 5]
port3 = list (score.index) [2 len (score) / 5:-2 len (score) / / 5]
port4 = list (score.index) [- 2*len (score) / / 5:-len (score) / 5]
port5 = list (score.index) [- len (score) / / 5:]

you want to get the close value of stock according to the difference of port.

def caculate_port_daily_return (port,start,end,close):

for stock in port

how do I get it? Please advise ~ Thank you ~

Mar.13,2021

-------------------------------
port1 = list(score.index)[: len(score)//5]
port2 = list(score.index)[ len(score)//5: 2*len(score)//5]
port3 = list(score.index)[ 2len(score)//5: -2len(score)//5]
port4 = list(score.index)[ -2*len(score)//5: -len(score)//5]
port5 = list(score.index)[ -len(score)//5: ]
--------------------------------

from collections import deque

-sharp deque([f1, f2, f3, f4, f5, f6, f7, f8, f9, f10])
list_ = deque(score.index)
eq = 5
el = len(score)//eq  -sharp = 2

-sharp     1         2         3         4         5    -> eq (5)
-sharp[[f1, f2], [f3, f4], [f5, f6], [f7, f8], [f9, f10]]
port = [[list_.popleft() for _ in range(el)] for _ in range(eq)]

i don't have any idea about "def calculate_port_daily_return"
check it plz: https://www.quantopian.com/posts/how-to-calculate-daily-return
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ad4e-41287.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ad4e-41287.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?