image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import plotly.offline as py

import warnings

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import squarify
import matplotlib.ticker as plticker
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
plt.style.use('fivethirtyeight')
import warnings
warnings.filterwarnings('ignore')
import plotly.offline as py
py.init_notebook_mode(connected=True)
import plotly.graph_objs as go
import plotly.tools as tls
import base64
import io
import codecs
from IPython.display import HTML
import jupyter

data = pd.read_csv('../input/WorldPopulation.csv', encoding='ISO-8859-1')

index_min = np.argmin(data['2016'])
index_max = np.argmax(data['2016'])
unit_min = data['Country'].values[index_min]
unit_max = data['Country'].values[index_max]

plt.subplots(figsize=(13, 8))
chart = plt.subplot(2, 2, 1)
withWorld = np.array(data['2016'])
withoutWorld = np.delete(withWorld, 210, axis=0)
plt.plot(withoutWorld)
plt.ylabel('Population', fontsize=12)
plt.xlabel('Population Countries Distribution', fontsize=12)
plt.annotate('Circa 200 countries \n Distribution of countries \n smaller than 100 Million', xy=(0.45, 0.95), xycoords='axes fraction', fontsize=10)
result2 = data[np.logical_and(data['2016'] > 10000000, data['2016'] < 100000000)]
result2 = result2['2016']
result3 = data[np.logical_and(data['2016'] > 1000000, data['2016'] < 10000000)]
result3 = result3['2016']
result4 = data['2016'] < 1000000
result4 = data[result4]['2016']
chart2 = plt.subplot(2, 2, 2)
result2.hist()
plt.setp(chart2, xticks=range(10000000, 100000000, 10000000), yticks=range(0, 35, 5))
plt.axvline(result2.mean(), linestyle='dashed', color='blue')
plt.ylabel('Number of Countries', fontsize=12)
plt.annotate('Countries between 10 and 100 Million \n Frequency distribution and median', xy=(0.3, 0.8), xycoords='axes fraction', fontsize=10)
chart3 = plt.subplot(2, 2, 3)
result3.hist()
plt.setp(chart3, xticks=range(1000000, 10000000, 1000000), yticks=range(0, 35, 5))
plt.ticklabel_format(style='sci', axis='x', scilimits=(0, 0))
plt.axvline(result3.mean(), linestyle='dashed', color='blue')
plt.ylabel('Number of Countries', fontsize=12)
plt.annotate('Countries between 1 and 10 Million \n Frequency distribution and median', xy=(0.45, 0.8), xycoords='axes fraction', fontsize=10)
chart4 = plt.subplot(2, 2, 4)
result4.hist()
plt.setp(chart4, xticks=range(100000, 1000000, 100000), yticks=range(0, 35, 5))
plt.axvline(result4.mean(), linestyle='dashed', color='blue')
plt.ticklabel_format(style='sci', axis='x', scilimits=(0, 0))
plt.ylabel('Number of Countries', fontsize=12)
plt.annotate('Countries smaller than 1 Million \n Frequency distribution and median', xy=(0.3, 0.8), xycoords='axes fraction', fontsize=10)