life_expectancy_values = [74.7, 75. , 83.4, 57.6, 74.6, 75.4, 72.3, 81.5, 80.2,
70.3, 72.1, 76.4, 68.1, 75.2, 69.8, 79.4, 70.8, 62.7,
67.3, 70.6]
gdp_values = [ 1681.61390973, 2155.48523109, 21495.80508273, 562.98768478,
13495.1274663 , 9388.68852258, 1424.19056199, 24765.54890176,
27036.48733192, 1945.63754911, 21721.61840978, 13373.21993972,
483.97086804, 9783.98417323, 2253.46411147, 25034.66692293,
3680.91642923, 366.04496652, 1175.92638695, 1132.21387981]
life_expectancy = pd.Series(life_expectancy_values)
gdp = pd.Series(gdp_values)
print life_expectancy[0]
print gdp[3:6]
74.7
3 562.987685
4 13495.127466
5 9388.688523
dtype: float64
print life_expectancy.mean()
print life_expectancy.std()
print gdp.max()
print gdp.sum()
72.87
6.21399947487
27036.4873319
182957.59833
a = pd.Series([1, 2, 3, 4])
b = pd.Series([1, 2, 1, 2])
print a + b
print a * 2
print a >= 3
print a[a >= 3]
0 2
1 4
2 4
3 6
dtype: int64
0 2
1 4
2 6
3 8
dtype: int64
0 False
1 False
2 True
3 True
dtype: bool
2 3
3 4
dtype: int64