Question: I am trying to update a connected account so it can accept the terms of service and be able to create a payout. however, when I try to run the code in the console so it updates it doesn't update and that error regarding the ip address pops up. I am following stripe's documentation to update accounts.

I have tried not including ip into the tos\_acceptance, but the ip is neccessary! 
I tried 'ip' and putting quotes around request.remote\_ip

```
"acct_id_12345", {
  tos_acceptance: {
    date: Time.now.to_i,
    ip: request.remote_ip,
  },
},
)

```

the error that appears is:

```
NameError: undefined local variable or method `request' for main:Object

```

Answer: 
IIUC, you need:

```
m=df1.set_index('Price').div(df1.set_index('Price').sum()).add_suffix('%')
df2=pd.concat([df1.set_index('Price'),m],axis=1).sort_index(axis=1).reset_index()

```

---

```
   Price   1        1%   2        2%   3        3%
0   0.00  10  0.222222  11  0.215686  15  0.882353
1   2.99  30  0.666667  40  0.784314   0  0.000000
2   4.99   5  0.111111   0  0.000000   2  0.117647

```

Note: this is assuming the dtypes are:

```
df1.dtypes
Price    float64
1          int32
2          int32
3          int32

```
```
a=df1.columns[1:]
df1[a+'%'] = df1[a].astype(float) / df1[a].astype(float).sum()

```

*output*

```
Price   1   2   3   1%           2%         3%
0.00    10  11  15  0.222222    0.215686    0.882353
2.99    30  40  0   0.666667    0.784314    0.000000
4.99    5   0   2   0.111111    0.000000    0.117647

```