I have two tables like this:
import pandas as pd
import numpy as np
data1 = [[1, 2000], [2, 3000]]
df_players = pd.DataFrame(data1, columns = ['cluster', 'users'])
df_players
| cluster | users |
|---|---|
| 1 | 2000 |
| 2 | 3000 |
data2 = [[1, 2], [2, 4]]
df_multiplyer = pd.DataFrame(data2, columns = ['cluster', 'multiplyer'])
df_multiplyer
| cluster | multiplyer |
|---|---|
| 1 | 2 |
| 2 | 4 |
And I have an array
coef = np.arange(.05, 0.16, 0.05)
coef
0.05
0.1
0.15
A want to create the table as shown below with calculated field users*myltiplyer*coeff
Desired output:
| cluster | num_users | multiplyer | coeffs | calculated_field |
|---|---|---|---|---|
| 1 | 2000 | 2 | 0.05 | 200 |
| 1 | 2000 | 2 | 0.1 | 400 |
| 1 | 2000 | 2 | 0.15 | 600 |
| 2 | 3000 | 4 | 0.05 | 600 |
| 2 | 3000 | 4 | 0.1 | 1200 |
| 2 | 3000 | 4 | 0.15 | 1800 |
Thanks for helping me!