0
Try this:
import pandas as pd
df = pd.DataFrame({
'a': ['Data Analisis', 'Machine Learning', 'Data Visualisation', 'Big Data', 'Deep Learning', 'Data Journalism'],
'b': [1688, 1629, 1340, 1332, 1263, 429],
'c': [444, 477, 734, 729, 770, 1081],
'd': [60, 74, 102, 127, 136, 610],
})
df['Total'] = df.sum(axis=1) # somar valores da linha, caso nao tenha isto logo a partida
# calcular percentagens
df['b %'] = df['b']/df['Total']*100
df['c %'] = df['c']/df['Total']*100
df['d %'] = df['d']/df['Total']*100
print(df)
OUTPUT:
a b c d Total b % c % d %
0 Data Analisis 1688 444 60 2192 77.007299 20.255474 2.737226
1 Machine Learning 1629 477 74 2180 74.724771 21.880734 3.394495
2 Data Visualisation 1340 734 102 2176 61.580882 33.731618 4.687500
3 Big Data 1332 729 127 2188 60.877514 33.318099 5.804388
4 Deep Learning 1263 770 136 2169 58.229599 35.500231 6.270171
5 Data Journalism 429 1081 610 2120 20.235849 50.990566 28.773585
Good morning, please enter the code you have tried and/or a sample of the data (.csv maybe) to make life easier for those who try to help you. Never put images because it makes it difficult to copy/Paste obviously.
– Miguel