Ask Your Question
0

To get the max value in row with excelpy

asked 2023-08-08 09:16:26 -0500

Jimmy gravatar image

updated 2023-08-08 09:19:32 -0500

My goal :To get the max value in row with excelpy

My thought : Is it possible to read the results in excel then I can do the max(row 3) 、max(row 4) ?

Is there any solution?

Thank you so much for reading my question.

My Code:

                   .
                   .

ierr,buses = psspy.abusint(1,1,string='NUMBER')

ierr,volts = psspy.abusreal(1,1,string='PU')

x1.set_range(2,'b',zip(*buses),True)

x1.set_range(3,'b',zip(*volts),True)
                   .
                   .
                   .
for  x in range(len( bus number))

z=x+4
                   .
                   .
                   .

ierr,volts_1 = psspy.abusreal(1,1,string='PU') 

x1.set_range(z,'b',zip(*volts_1),True)

del z

Result in Excel:

       a    b    c    d    e    f    g    h       i   
1

2     1     2    3    4    5    6    7    8              (buses number)

3    10     5   30   85    50   60   75   80     (85)    (volts)  (max value in row 3 is 85)

4    90    60   20   10    5    6    8    12     (90)    (volts)  (max value in row 4 is 90)

5    6     10  ..............................            (volts)

6   .........................................            (volts)
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2023-08-08 12:20:53 -0500

perolofl gravatar image

I'm not sure what you mean, but you can write the max value for line 3 with:

x1.set_cell((3,2+len(volts[0])),max(volts[0]))

The value will be written after the last column.

edit flag offensive delete link more

Comments

Thank you for giving me this idea. I solve the problem. Thanks

Jimmy gravatar imageJimmy ( 2023-08-08 20:16:07 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2023-08-08 09:16:26 -0500

Seen: 120 times

Last updated: Aug 08 '23