• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

<button aria-describedby="--stacks-s-tooltip-3b3jabnb" aria-label="Bookmark" aria-pressed="false" class="js-bookmark-btn s-btn s-btn__unset c-pointer py4 js-gps-track" data-controller="s-tooltip" data-gps-track="post.click({ item: 1, priv: 0, post_type: 1 })" data-s-tooltip-placement="right" data-selected-classes="fc-yellow-600"></button><svg aria-hidden="true" class="mln2 mr0 svg-icon iconHistory" height="18" viewbox="0 0 19 18" width="19"></svg>

 

I have 2 df as Main df

main_df=pd.DataFrame(np.arange(3,9).reshape(-1,2), columns = list('AB'))

    A   B
0   3   4
1   5   6
2   7   8

weights df

w_df=pd.DataFrame(np.arange(1,5).reshape(-1,2), columns = ['wA','wB'])/10

    wA  wB
0   0.1 0.2
1   0.3 0.4

I need to multiply specific row from weights df into all columns of main df and put the summation into a column in main df so output should be like in case of using 1st row from weights df

Prod Sum of 1st row in main = 0.1 * 3 + 0.2 *4 = 1.1

Prod Sum of 2nd row in main = 0.1 * 5 + 0.2 *6 = 1.7

Prod Sum of 3rd row in main = 0.1 * 7 + 0.2 *8 = 2.3

i.e. output of main df should be like (in case of using 1st row from weights df)

    A   B   prod_sum
0   3   4   1.1
1   5   6   1.7
2   7   8   2.3