0

This is first dataframe df1:

   DP 1   DP 2    DP 3    DP 4    DP 5    DP 6    DP 7    DP 8     DP 9   DP 10
 3.034   1.581   1.377   1.244   1.164   1.089   1.054   1.071   1.008  
 2.688   1.753   1.464   1.139   1.058   1.114   1.061   1.058      
 4.143   1.781   1.439   1.174   1.180   1.168   1.039          
 2.880   1.853   1.579   1.073   1.200   1.072              
 3.034   1.874   1.564   1.230   1.126                  
 3.520   1.717   1.292   1.188                      
 3.297   1.556   1.548                          
 2.696   1.752                              
 3.495          

                    

This is my second dataframe df2:(

     DP 1       DP 2       DP 3         DP 4        DP 5       DP 6         DP 7        DP 8        DP 9       DP 10
 3,57,848    11,24,788   17,35,330   22,18,270   27,45,596   33,19,994   34,66,336   36,06,286   38,33,515   39,01,463 
 3,52,118    12,36,139   21,70,033   33,53,322   37,99,067   41,20,063   46,47,867   49,14,039   53,39,085  
 2,90,507    12,92,306   22,18,525   32,35,179   39,85,995   41,32,918   46,28,910   49,09,315      
 3,10,608    14,18,858   21,95,047   37,57,447   40,29,929   43,81,982   45,88,268          
 4,43,160    11,36,350   21,28,333   28,97,821   34,02,672   38,73,311              
 3,96,132    13,33,217   21,80,715   29,85,752   36,91,712                  
 4,40,832    12,88,463   24,19,861   34,83,130                      
 3,59,480    14,21,128   28,64,498                          
 3,76,686    13,63,294                              
 3,44,014               

=SUMPRODUCT(E1:E9,B1:B8)/SUM(OFFSET(B1,0,0,10-COLUMNS($B$1:B1))) It is a excel formula i would like to implement in dataframe of python. where E1:E9 is df1 rows of DP1 column and B1:B8 is df2 rows of DP1 column

I don't know how to calculate this in python.

i Need Output like this: 3.188 1.735 1.470 1.166 1.146 1.111 1.051 1.063 1.008 1.000

Thank You For Your Time:)

Devil
  • 83
  • 8

1 Answers1

0

For the sumproduct you can see: Python SUMPRODUCT of elements in nested list.

Offset is a prerogative of spreadsheet, or in general of the data structure you are using. python doesn't have tabular concept, but using pandas you can reproduce something similar.

Glauco
  • 1,385
  • 2
  • 10
  • 20