python - Get data from cell in pandas and user it in calculations -
i've got csv file loading in table using pandas.
rank player nat tot mtchwin-loss tie brkwin-loss \ 0 1 novak djokovic srb 5-0 0-0 1 2 roger federer sui 1-1 0-1 2 3 andy murray gbr 0-0 0-0 3 4 rafael nadal esp 11-3 2-1 4 5 kei nishikori jpn 5-0 0-0 5 6 milos raonic can 2-1 1-0 6 7 tomas berdych cze 4-1 2-0 7 8 david ferrer esp 10-2 2-2 8 9 stan wawrinka sui 1-1 0-0 9 10 marin cilic cro 2-2 1-0 10 11 grigor dimitrov bul 3-1 0-0 11 12 feliciano lopez esp 5-3 4-1 12 13 gilles simon fra 3-2 2-0 13 14 jo-wilfried tsonga fra 2-2 0-1 14 15 gael monfils fra 6-2 5-0 15 16 roberto bautista agut esp 4-3 2-2 16 17 kevin anderson rsa 2-1 1-3 17 18 john isner usa 2-2 2-2 18 19 tommy robredo esp 6-5 0-2 19 20 ernests gulbis lat 0-2 0-0 20 21 david goffin bel 1-1 0-0 21 22 ivo karlovic cro 1-1 0-0 22 23 pablo cuevas uru 10-4 4-2 23 24 martin klizan svk 10-5 3-1 24 25 leonardo mayer arg 4-4 2-1 25 26 philipp kohlschreiber ger 3-2 3-2 26 27 bernard tomic aus 1-1 1-1 27 28 richard gasquet fra 0-0 0-0 28 29 fabio fognini ita 8-5 3-2 29 30 adrian mannarino fra 0-1 0-0 .. ... ... ... ... ... 170 171 elias ymer swe 2-2 1-1 171 172 renzo olivo arg 2-2 2-1 172 173 tommy haas ger 0-0 0-0 173 174 nicolas almagro esp 8-5 3-2 174 175 alex bolt aus 0-0 0-0 175 176 mate delic cro 0-0 0-0 176 177 liam broady gbr 0-0 0-0 177 178 maxime authom bel 0-0 0-0 178 179 roberto marcora ita 0-0 0-0 179 180 marius copil rou 0-1 0-0 180 181 lukasz kubot pol 0-0 0-0 181 182 guilherme clezar bra 0-3 0-1 182 183 ruben ramirez hidalgo esp 0-0 0-0 183 184 andrej martin svk 0-0 0-0 184 185 andrea arnaboldi ita 0-0 0-0 185 186 gerald melzer aut 1-1 2-1 186 187 jan hernych cze 0-0 0-0 187 188 julian reister ger 0-0 0-0 188 189 nicolas jarry chi 3-1 1-0 189 190 mirza basic bih 0-0 0-0 190 191 filippo volandri ita 0-0 0-0 191 192 dennis novikov usa 0-0 0-0 192 193 denys molchanov ukr 0-0 0-0 193 194 jason jung usa 0-0 0-0 194 195 luke saville aus 0-0 0-0 195 196 evgeny donskoy rus 0-1 0-1 196 197 adrian ungur rou 0-0 0-0 197 198 hans podlipnik-castillo chi 1-0 0-0 198 199 thomas fabbiano ita 0-1 0-0 199 200 tim puetz ger 0-0 0-0 tot aces ace/ mtch avg tot dbl flts df/ mtch avg 1st srv 1st srv won \ 0 9 1.8 7 1.4 62% 74% 1 9 4.5 2 1.0 59% 68% 2 0 0.0 0 0.0 0% 0% 3 25 1.8 18 1.3 68% 69% 4 14 2.8 9 1.8 57% 75% 5 16 5.3 3 1.0 64% 78% 6 18 3.6 8 1.6 53% 81% 7 18 1.5 32 2.7 62% 66% 8 2 1.0 2 1.0 58% 64% 9 20 5.0 5 1.3 60% 72% 10 12 3.0 5 1.3 63% 74% 11 66 8.3 23 2.9 60% 74% 12 14 2.8 13 2.6 64% 63% 13 13 3.3 5 1.3 59% 70% 14 32 4.0 5 0.6 63% 69% 15 16 2.3 13 1.9 64% 73% 16 40 13.3 9 3.0 65% 74% 17 49 12.3 6 1.5 68% 77% 18 41 3.7 20 1.8 66% 72% 19 9 4.5 15 7.5 52% 67% 20 9 4.5 7 3.5 51% 67% 21 23 11.5 4 2.0 71% 86% 22 78 6.5 22 1.8 56% 74% 23 49 3.1 54 3.4 59% 70% 24 41 6.8 13 2.2 64% 71% 25 10 1.7 5 0.8 65% 61% 26 11 3.7 2 0.7 70% 66% 27 0 0.0 0 0.0 0% 0% 28 41 2.9 35 2.5 57% 65% 29 0 0.0 2 2.0 64% 47% .. ... ... ... ... ... ... 170 12 3.0 6 1.5 58% 65% 171 9 2.3 36 9.0 57% 71% 172 0 0.0 0 0.0 0% 0% 173 81 5.8 25 1.8 56% 75% 174 0 0.0 0 0.0 0% 0% 175 0 0.0 0 0.0 0% 0% 176 0 0.0 0 0.0 0% 0% 177 0 0.0 0 0.0 0% 0% 178 0 0.0 0 0.0 0% 0% 179 8 8.0 2 2.0 60% 78% 180 0 0.0 0 0.0 0% 0% 181 11 3.7 10 3.3 61% 64% 182 0 0.0 0 0.0 0% 0% 183 0 0.0 0 0.0 0% 0% 184 0 0.0 0 0.0 0% 0% 185 11 5.5 6 3.0 58% 75% 186 0 0.0 0 0.0 0% 0% 187 0 0.0 0 0.0 0% 0% 188 25 12.5 10 5.0 60% 72% 189 0 0.0 0 0.0 0% 0% 190 0 0.0 0 0.0 0% 0% 191 0 0.0 0 0.0 0% 0% 192 0 0.0 0 0.0 0% 0% 193 0 0.0 0 0.0 0% 0% 194 0 0.0 0 0.0 0% 0% 195 1 1.0 9 9.0 52% 70% 196 0 0.0 0 0.0 0% 0% 197 0 0.0 0 0.0 0% 0% 198 3 3.0 4 4.0 73% 61% 199 0 0.0 0 0.0 0% 0% 2nd srv won srv gam won brk pts won brk pts svd pts won ret srv1st-2nd \ 0 58% 88% 42% 68% 39%-57% 1 54% 84% 46% 67% 37%-49% 2 0% 0% 0% 0% 0%-0% 3 57% 82% 43% 57% 36%-58% 4 62% 92% 49% 80% 39%-62% 5 62% 90% 25% 50% 26%-46% 6 52% 82% 47% 68% 37%-49% 7 54% 78% 47% 61% 40%-56% 8 50% 59% 25% 46% 41%-47% 9 49% 74% 43% 58% 26%-43% 10 49% 85% 38% 79% 35%-48% 11 54% 82% 42% 65% 28%-50% 12 47% 68% 56% 63% 31%-56% 13 58% 87% 31% 78% 26%-45% 14 53% 82% 42% 68% 31%-51% 15 48% 80% 53% 62% 29%-53% 16 47% 83% 55% 68% 35%-47% 17 56% 91% 25% 75% 26%-39% 18 52% 82% 42% 65% 32%-48% 19 32% 50% 33% 50% 29%-39% 20 55% 76% 38% 69% 38%-52% 21 43% 88% 22% 25% 21%-45% 22 54% 82% 49% 63% 32%-47% 23 48% 76% 43% 63% 31%-49% 24 50% 81% 23% 65% 31%-57% 25 52% 67% 48% 51% 35%-54% 26 47% 73% 38% 58% 33%-52% 27 0% 0% 0% 0% 0%-0% 28 49% 67% 49% 61% 32%-54% 29 41% 29% 33% 50% 26%-38% .. ... ... ... ... ... 170 50% 69% 38% 60% 30%-55% 171 51% 79% 27% 62% 29%-51% 172 0% 0% 0% 0% 0%-0% 173 55% 82% 32% 59% 32%-47% 174 0% 0% 0% 0% 0%-0% 175 0% 0% 0% 0% 0%-0% 176 0% 0% 0% 0% 0%-0% 177 0% 0% 0% 0% 0%-0% 178 0% 0% 0% 0% 0%-0% 179 56% 77% 43% 40% 36%-39% 180 0% 0% 0% 0% 0%-0% 181 44% 67% 39% 50% 24%-53% 182 0% 0% 0% 0% 0%-0% 183 0% 0% 0% 0% 0%-0% 184 0% 0% 0% 0% 0%-0% 185 43% 77% 14% 73% 21%-51% 186 0% 0% 0% 0% 0%-0% 187 0% 0% 0% 0% 0%-0% 188 62% 86% 38% 75% 25%-43% 189 0% 0% 0% 0% 0%-0% 190 0% 0% 0% 0% 0%-0% 191 0% 0% 0% 0% 0%-0% 192 0% 0% 0% 0% 0%-0% 193 0% 0% 0% 0% 0%-0% 194 0% 0% 0% 0% 0%-0% 195 52% 79% 18% 70% 28%-42% 196 0% 0% 0% 0% 0%-0% 197 0% 0% 0% 0% 0%-0% 198 39% 60% 17% 43% 22%-45% 199 0% 0% 0% 0% 0%-0% ret gam won 0 46% 1 33% 2 0% 3 38% 4 42% 5 12% 6 30% 7 42% 8 33% 9 15% 10 25% 11 20% 12 31% 13 13% 14 24% 15 26% 16 26% 17 8% 18 27% 19 16% 20 32% 21 8% 22 25% 23 25% 24 21% 25 36% 26 32% 27 0% 28 31% 29 13% .. ... 170 23% 171 17% 172 0% 173 22% 174 0% 175 0% 176 0% 177 0% 178 0% 179 23% 180 0% 181 22% 182 0% 183 0% 184 0% 185 11% 186 0% 187 0% 188 11% 189 0% 190 0% 191 0% 192 0% 193 0% 194 0% 195 14% 196 0% 197 0% 198 11% 199 0%
i'm not sure why goes on different lines, ideally want see go way horizontally that's not massive issue. want to able data cells based on criteria. example i've done 1st serve percentage of novak djokovic:
firstservepecentage = df[["1st srv"]][df['player'] == 'novak djokovic']
this returns:
1st srv 0 62%
as can see gets column , row names. how can value 62% can convert decimal, 0.62, , able assign variable can use calculations?
what returned series, if want value:
firstservepecentage = df[df['player'] == 'novak djokovic']['1st srv'] firstservepecentage.values[0]
Comments
Post a Comment