i have 24 columns in my csv files ,named as following: c1hHigh,c2hHigh,c3hHigh ...…
- User
i have 24 columns in my csv files ,named as following: c1_h_High,c2_h_High,c3_h_High ... c24_h_High and they have numeric values for each row i want to add a value as a new column named "y_High", which is the highest value of mentioned columns in two next rows, in oder words ,i want to find the highest value of them and add as new column named "y_High", each two rows highest value of mentioned columns should added as previous row's "y_High" value
i also have 24 columns in my csv files ,named as following: c1_h_Low,c2_h_Low,c3_h_Low ... c24_h_Low and they have numeric values for each row i want to add a a value as a new column named "y_Low", which is the highest value of mentioned columns of two next row in oder words ,i want to find the lowest value of them and add as new column named "y_Low", each two rows lowest value of mentioned columns should added as previous row's "y_Low" value
also i want add a new column as "y_Priority" and its value should be a 0 or 1 should be calculated by looking next two rows c1_h_Low,c2_h_Low,c3_h_Low ... c24_h_Low and c1_h_High,c2_h_High,c3_h_High ... c24_h_High values to determine :
if highest value of c1_h_High,c2_h_High,c3_h_High ... c24_h_High columns, occurs before the Lowest value of c1_h_Low,c2_h_Low,c3_h_Low ... c24_h_Low columns, then y_Priority should be 1, otherwise it should be 0
considere that in calculating y_High and y_Low for each row,their value can be in first next row's corresponding values ,or in second next row's corresponding values (it means for finding Highest and Lowest values of mentioned columns ,you should look 48 values of next two rows , 24 first next row,24 second next row,and choose between those 48...and calculate y_Priority same)
and also followings should considered: if Highest and Lowest value are in the same next row(both in first next row,or second next row),and for example highest value is in column c15_h_High column and the Low value is in c8_h_Low, then the value of y_priority of current row should be 0 (15 is after 8)
or if Highest and Lowest value are in the same next row(both in first next row,or second next row),and for example highest value is in column c8_h_High column and the Low value is in c15_h_Low, then the value of y_priority of current row should be 1 (8 is before 15)
finding y_High and y_Low and y_priority with looking next two rows, if Highest value of next two rows is placed in one of first next row values, and Lowest value of next two rows is placed in second next row values ,then the value of y_priority of current row should be 1 (when high is in first next row ,it means it happend before Low, which is in the second next row)
finding y_High and y_Low and y_priority with looking next two rows, if Highest value of next two rows is placed in one of second next row values, and Lowest value of next two rows is placed in first next row values ,then the value of y_priority of current row should be 0 (when high is in second day, and Low is in first next row , which means High happend after low )
- Assistant
- User
i should mention that my csv file contains other columns that their names contain _High _Low High Low...
so update the code to select value and columns with more percise
- Assistant
- User
there is a problem it calculate new columns just for first row and not others
- Assistant