I just got started with numpy..
Got the below np table and would like calculate the each cell's percentage of the column total.
data = np.array([[7,16,17], [12,11,3]])
headers = ["Grundskola", "Gymn", "Akademisk"]
# tabulate data
table = tabulate(data, headers, tablefmt="github")
# output
print(table)
| Grundskola | Gymn | Akademisk |
|--------------|--------|-------------|
| 7 | 16 | 17 |
| 12 | 11 | 3 |
to:
| Grundskola | Gymn | Akademisk |
|--------------|--------|-------------|
| 39%| 59% | 85% |
| 61%| 41% | 15% |
I know that np.sum(data2, axis=0/1) will give me the totals but how do I use to calculate the array.
The array can vary in size...