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: 
In order to get the Output, you need to convert string to numeric using [`pd.to_numeric`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_numeric.html)

```
pd.concat([df1, df1.drop('Price',1).apply(lambda x: pd.to_numeric(x).div(pd.to_numeric(x).sum()))
               .rename(columns=lambda x: x+'%')], 1)

```

Output:

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

```
Let's break down your question into 2 parts:

**1) Why you get an error when you try to calculate the percentage for each column:**

Basically, your columns are string types. You can either transform your column into a float type or change the type when defining your dataframe:

* Changing the type of a column: `df1['1%'] = df1['1%].astype(float)`
* Changing the type when defining your dataframe:

`d1 = [[0.00, 10, 11, 15], [ 2.99, 30, 40, 0], [ 4.99, 5, 0, 2]]`

**2) Iterate the formula through all the columns:**

The following code iterate your formula and create another column in the original dataframe:

```
for column in df1.drop(['Price'], axis=1).columns:
    df1[column + '%'] = df1[column] / df1[column].sum()

```