<jupyter_start><jupyter_text>Covid World Vaccination 💉  > Context: Data is collected daily from Our World in Data GitHub repository for covid-19, merged and uploaded. Country level vaccination data is gathered and assembled in one single file. Then, this data file is merged with locations data file to include vaccination sources information. A second file, with manufacturers information, is included.      📌 In This Notebook we'll try to analyse the Covid World Vaccination dataset     that contain some columns such as                Date information         Country Name         Daily vaccinations per million         the source and more                We are going to analysis 2 files by creating some useful function and plotting the results    Used Library 📖 We'll use basic python library well known for data analysis and observation *  Numpy link: https://numpy.org*  Pandas link: https://pandas.pydata.org*  Matplotlib link: https://matplotlib.org*  Plotly link: https://plotly.com<jupyter_code>import numpy as np
import pandas as pd 
import seaborn as sns 
import matplotlib.pyplot as plt 
from plotly.offline import init_notebook_mode, iplot, plot
import plotly as py
init_notebook_mode(connected=True)
import plotly.graph_objs as go
import plotly.express as px
from pandas_profiling import ProfileReport<jupyter_output><empty_output><jupyter_text>First Look to the Data 👀     📌 Here we are going to create one function that i thought useful when you need to get the original data sometimes after a bug to fix it,so i create a function getDf that return the original data set then we'll look at the columns name  Check the head of the data, Get the description and info about it ℹ️  Add a profiling to get a summary of the whole dataset<jupyter_code>def getDf():
    
    df = pd.read_csv('/kaggle/input/covid-world-vaccination-progress/country_vaccinations.csv')
    return df

df = getDf()

df.columns
df.info()
df.describe()<jupyter_output><empty_output><jupyter_text>For those who want a well structured and global information<jupyter_code>"""
profiling = ProfileReport(df)
profiling.to_file("profiling.html")
profiling
"""<jupyter_output><empty_output><jupyter_text>Exemple Plotting      📌 Here we are going to create a function that get a Country Name in parameter and make a plot of the daily vaccination it is easy with this function to get for each country his daily vaccination information<jupyter_code>def dateVacination(countryCode):
    df = getDf()
    
    dfA = df[df['iso_code'] == countryCode]
    liste = list(set(dfA['country']))

    fig = px.scatter(x=dfA['date'] , y=dfA['daily_vaccinations'],title='Country {}'.format(liste[0]))

    fig.show()
    

liste = list(set(df['iso_code']))

for i in range(3):
    source_code = liste[i]
    dateVacination(source_code)<jupyter_output><empty_output><jupyter_text>**You can see some missing value in the data**   Data Analysis 📈     📌 In this section we are going to make some basic analysis of the data using different type of plotfirst we are going to see for the last date which is the 2022-02-04 the repartition of daily vaccinations<jupyter_code>df = df[ df['date'] == '2022-02-04']
df = df[['country','daily_vaccinations']].sort_values(by='daily_vaccinations', ascending=False)
fig = px.treemap(df, path=[px.Constant('daily_vaccinations'),'country'], values='daily_vaccinations',
                   hover_data=['country'])
fig.show()<jupyter_output><empty_output><jupyter_text>Compare it with the first day<jupyter_code>df = getDf()

df = df[ df['date'] == '2021-02-22']
df = df[['country','daily_vaccinations']].sort_values(by='daily_vaccinations', ascending=False)
fig = px.treemap(df, path=[px.Constant('daily_vaccinations'),'country'], values='daily_vaccinations',
                   hover_data=['country'])
fig.show()<jupyter_output><empty_output><jupyter_text>📌 NOTE: India took the place of the United States   Version 1   Go Deeper Into The Analysis     📌 The dataframe give us the ratio per percent, vaccination / population that is helpful for us<jupyter_code>df = getDf()
df = df[ df['date'] == '2022-02-04']
df = df.sort_values(by='people_vaccinated_per_hundred',ascending=False)
px.bar(df.head(10), x='country', y='people_vaccinated_per_hundred',
                   title='People Vaccinated per Hundred for the Date 2022-02-04')<jupyter_output><empty_output><jupyter_text>📌 We can say that often theses country total population are between 5 to 40 Millions<jupyter_code>df = df.sort_values(by='people_fully_vaccinated_per_hundred',ascending=False)

px.bar(df.head(10), x='country', y='people_fully_vaccinated_per_hundred',
                   title='People Fully Vaccinated per Hundred for the Date 2022-02-04')<jupyter_output><empty_output><jupyter_text>📌 The classement don't change a lot, United Arab Emirates become first   Second Part ❷     📌 let take a look at the second file that we have<jupyter_code>def getDfA():
    
    dfA = pd.read_csv('/kaggle/input/covid-world-vaccination-progress/country_vaccinations_by_manufacturer.csv')
    return dfA<jupyter_output><empty_output><jupyter_text>📌 I do the same thing as the first file by creating a function for this file to, firstly         let's get the last date vaccinations records<jupyter_code>dfA = getDfA()
dfA = dfA[dfA.date == '2022-02-04']
dfA.head()
def vaccineRepartition(location):

    dictObject = {}
    
    dfA = getDfA()
   
    dfA = dfA[dfA['location'] == location]

    fig = px.bar(x=dfA['vaccine'], y=dfA['total_vaccinations'],
                   title='Most Used Vaccine for {}'.format(location))
    
    fig.show()
vaccineRepartition('Belgium') # change the name Belgium with what you want<jupyter_output><empty_output><jupyter_text>📌 Belgium use the vaccine BioNTech vaccine the most,there aren't the statistics for some Country like  India,or China nor for the USA<jupyter_code>total  = dfA.groupby('vaccine').sum()

px.bar(x=total.index, y=total['total_vaccinations'],
                   title='Most Used Vaccine in the World')<jupyter_output><empty_output><jupyter_text>📌 Most used vaccine in the world is BioNTech<jupyter_code>dfA = getDfA()
dfA.columns
bestTotalVac = dfA[dfA['total_vaccinations'] == max(dfA['total_vaccinations'])]

bestTotalVac<jupyter_output><empty_output><jupyter_text>📌 European Union has made 56730415 vaccinations, let's look it with the date<jupyter_code>europeanUnion = dfA[dfA['location'] ==  'European Union']
px.line(europeanUnion, x="date", y="total_vaccinations",color='vaccine',title='European Union Vaccination')<jupyter_output><empty_output><jupyter_text>📌 We can create a function for this too<jupyter_code>def vaccinationDuration(location):
    
    dfA = getDfA()
    
    europeanUnion = dfA[dfA['location'] ==  location]
    
    fig = px.line(europeanUnion, x="date", y="total_vaccinations",color='vaccine',title='{} Vaccination'.format(location))
    
    fig.show()

import random 
listeOfCountry = list(set(dfA['location']))

for i in range(3):
    location = random.choice(listeOfCountry)
    vaccinationDuration(location)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10265461733973454, 'fraction_numerical': 0.011013837898898616, 'mean_word_length': 4.897585345545379, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 58, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '241081', 'license': 'Apache-2.0', 'n_tokens_mistral': 2371, 'n_tokens_neox': 2217, 'n_words': 670, 'path': 'covid-world-vaccination.ipynb', 'repo_name': 'theyazilimci/KaggleProject', 'size': '7082'}