In [1]:
import pandas as pd

In [2]:
c=pd.read_html('https://en.wikipedia.org/wiki/List_of_foreign_aid_recipients')[0]

In [3]:
c=c.drop([0,2],axis=1).set_index(1)

In [4]:
d=pd.read_html('https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)_per_capita')[2]

In [5]:
d=d.drop([0],axis=1).set_index(1)

In [6]:
import numpy as np

In [7]:
a=[]
b=[]
e=[]
for i in c.index[1:]:
    if i in d.index:
        print i,c.loc[i].values[0],np.float(d.loc[i].values[0])
        a.append(i)
        b.append(np.float(c.loc[i].values[0]))
        e.append(np.float(d.loc[i].values[0]))


Afghanistan 5265.95 600.0
Albania 298.38 3995.0
Algeria 207.96 4318.0
Angola 287.61 4100.0
Argentina 30.12232 13589.0
Armenia 292.76 3535.0
Azerbaijan -63.13 5739.0
Bangladesh 2669.1 1287.0
Belarus 104.68 5749.0
Belize 49.55 4842.0
Benin 652.61 780.0
Bhutan 134.69 2843.0
Bolivia 699.15 2886.0
Botswana 108.38 6041.0
Brazil 1150.17 8670.0
Burkina Faso 1040.11 615.0
Burundi 546.27 306.0
Cambodia 804.81 1168.0
Cameroon 737.49 1232.0
Cape Verde 243.37 3039.0
Central African Republic 189.25 335.0
Chad 399.33 943.0
Chile 78.52 13341.0
China -65111.0 7990.0
Colombia 852.03 6084.0
Comoros 81.9 736.0
Costa Rica 37.77 10936.0
Côte d'Ivoire 1262.0 1315.0
Djibouti 152.95 1788.0
Dominica 19.8 7030.0
Dominican Republic 148.13 6756.0
Ecuador 147.8 6071.0
Egypt 5505.0 3740.0
El Salvador 171.3 4040.0
Equatorial Guinea 5.7 11762.0
Eritrea 83.69 695.0
Ethiopia 3826.2 687.0
Fiji 90.9 5374.0
Gabon 90.8 7736.0
Georgia 652.7 3789.0
Ghana 1330.5 1340.0
Grenada 10.0 8937.0
Guatemala 494.1 3929.0
Guinea 499.5 542.0
Guinea-Bissau 103.6 595.0
Guyana 101.8 4125.0
Haiti 1170.5 805.0
Honduras 627.6 2407.0
India 2435.68 1617.0
Indonesia 53.3 3362.0
Iran 131.3 4877.0
Iraq 1541.4 4819.0
Israel 3150.0 35343.0
Jamaica 70.3 4948.0
Jordan 1407.9 5513.0
Kazakhstan 91.3 9796.0
Kenya 3236.2 1388.0
Kiribati 64.4 1428.0
Kyrgyzstan 536.6 1113.0
Laos 421.0 1779.0
Lebanon 626.4 11237.0
Lesotho 320.0 1052.0
Liberia 534.2 474.0
Libya 129.4 6059.0
Madagascar 499.7 402.0
Malawi 1125.8 354.0
Malaysia -119.4 9557.0
Maldives 22.9 9000.0
Mali 1391.3 802.0
Marshall Islands 93.7 3356.0
Mauritania 291.2 1282.0
Mauritius 148.3 9218.0
Mexico 560.6 9009.0
Moldova 374.4 1805.0
Mongolia 428.2 3952.0
Montenegro 127.3 6489.0
Morocco 1966.1 3079.0
Mozambique 2314.1 535.0
Myanmar 3934.8 1292.0
Namibia 261.7 5777.0
Nepal 870.5 751.0
Nicaragua 496.6 1949.0
Niger 773.1 405.0
Nigeria 2529.4 2743.0
Pakistan 2174.1 1450.0
Palau 35.2 16070.0
Panama 6.8 13013.0
Papua New Guinea 656.2 2085.0
Paraguay 129.4 4010.0
Peru 367.5 6021.0
Rwanda 1081.1 732.0
Samoa 118.1 4334.0
Senegal 982.8 913.0
Serbia 783.2 5120.0
Seychelles 25.4 14941.0
Sierra Leone 443.7 659.0
Solomon Islands 288.3 1952.0
South Africa 1292.9 5695.0
South Sudan 1447.4 221.0
Sri Lanka 423.2 3889.0
Saint Vincent and the Grenadines 7.5 6882.0
Sudan 1163.1 2175.0
Suriname 29.8 9306.0
Swaziland 115.9 3140.0
Tajikistan 382.2 922.0
Tanzania 3430.2 942.0
Thailand -23.7 5742.0
Togo 220.5 569.0
Tonga 80.3 3973.0
Tunisia 713.6 3923.0
Turkey 2740.5 9437.0
Turkmenistan 37.3 6622.0
Tuvalu 26.6 3015.0
Uganda 1692.5 620.0
Ukraine 800.7 2005.0
Uruguay 35.7 15748.0
Uzbekistan 292.5 2121.0
Vanuatu 90.5 2847.0
Venezuela 35.4 7745.0
Vietnam 4084.7 2088.0
Yemen 1003.5 1303.0
Zambia 1142.4 1350.0
Zimbabwe 811.0 1064.0

In [18]:
import random
from IPython import display as d
import nvd3

In [19]:
nvd3.ipynb.initialize_javascript(use_remote=True)
chart = nvd3.scatterChart(name='scatterChart_1', width=600, height=300, x_is_date=False)
nb_element = 50

kwargs1 = {'shape': 'circle', 'size': '1'}

extra_serie = {"tooltip": {"y_start": a, "y_end": " calls"}}
chart.add_serie(name="serie 1", y=e, x=b, extra=extra_serie, **kwargs1)
chart


Out[19]:

In [10]:
import matplotlib.pyplot as plt
%matplotlib inline

In [17]:
plt.scatter(b,e)
plt.xlim(0,6000)
#plt.xscale('log')
#plt.yscale('log')


Out[17]:
(0, 6000)

In [12]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np

In [13]:
# Scatter points
fig, ax = plt.subplots()
np.random.seed(0)
x, y = np.random.normal(size=(2, 200))
color, size = np.random.random((2, 200))

ax.scatter(x, y, c=color, s=500 * size, alpha=0.3)
ax.grid(color='lightgray', alpha=0.7)



In [15]:
import mpld3
mpld3.display(fig)


Out[15]: