Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
import pandas as pd
df = pd.read_csv('perception2.csv')
df
df[['Overall rank', 'Country or region', 'GDP per capita']]
df.iloc[151]
Overall rank 152
Country or region Rwanda
Score 3.334
GDP per capita 0.359
Perceptions of corruption 0.411
Name: 151, dtype: object
df.iloc[12:19]
for index, rows in df.iterrows():
print(index, rows['Country or region'])
0 Finland
1 Denmark
2 Norway
3 Iceland
4 Netherlands
5 Switzerland
6 Sweden
7 New Zealand
8 Canada
9 Austria
10 Australia
11 Costa Rica
12 Israel
13 Luxembourg
14 United Kingdom
15 Ireland
16 Germany
17 Belgium
18 United States
19 Czech Republic
20 United Arab Emirates
21 Malta
22 Mexico
23 France
24 Taiwan
25 Chile
26 Guatemala
27 Saudi Arabia
28 Qatar
29 Spain
30 Panama
31 Brazil
32 Uruguay
33 Singapore
34 El Salvador
35 Italy
36 Bahrain
37 Slovakia
38 Trinidad & Tobago
39 Poland
40 Uzbekistan
41 Lithuania
42 Colombia
43 Slovenia
44 Nicaragua
45 Kosovo
46 Argentina
47 Romania
48 Cyprus
49 Ecuador
50 Kuwait
51 Thailand
52 Latvia
53 South Korea
54 Estonia
55 Jamaica
56 Mauritius
57 Japan
58 Honduras
59 Kazakhstan
60 Bolivia
61 Hungary
62 Paraguay
63 Northern Cyprus
64 Peru
65 Portugal
66 Pakistan
67 Russia
68 Philippines
69 Serbia
70 Moldova
71 Libya
72 Montenegro
73 Tajikistan
74 Croatia
75 Hong Kong
76 Dominican Republic
77 Bosnia and Herzegovina
78 Turkey
79 Malaysia
80 Belarus
81 Greece
82 Mongolia
83 North Macedonia
84 Nigeria
85 Kyrgyzstan
86 Turkmenistan
87 Algeria
88 Morocco
89 Azerbaijan
90 Lebanon
91 Indonesia
92 China
93 Vietnam
94 Bhutan
95 Cameroon
96 Bulgaria
97 Ghana
98 Ivory Coast
99 Nepal
100 Jordan
101 Benin
102 Congo (Brazzaville)
103 Gabon
104 Laos
105 South Africa
106 Albania
107 Venezuela
108 Cambodia
109 Palestinian Territories
110 Senegal
111 Somalia
112 Namibia
113 Niger
114 Burkina Faso
115 Armenia
116 Iran
117 Guinea
118 Georgia
119 Gambia
120 Kenya
121 Mauritania
122 Mozambique
123 Tunisia
124 Bangladesh
125 Iraq
126 Congo (Kinshasa)
127 Mali
128 Sierra Leone
129 Sri Lanka
130 Myanmar
131 Chad
132 Ukraine
133 Ethiopia
134 Swaziland
135 Uganda
136 Egypt
137 Zambia
138 Togo
139 India
140 Liberia
141 Comoros
142 Madagascar
143 Lesotho
144 Burundi
145 Zimbabwe
146 Haiti
147 Botswana
148 Syria
149 Malawi
150 Yemen
151 Rwanda
152 Tanzania
153 Afghanistan
154 Central African Republic
155 South Sudan