<jupyter_start><jupyter_text>Nigeria Covid'19 Data Visualization  About the Data Set<jupyter_code>import numpy as np  # useful for many scientific computing in Python
import pandas as pd # primary data structure library
# we are using the inline backend
%matplotlib inline 

import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
  ngcovid = pd.read_csv('data/covid19dataset.csv')

print ('Data read into a pandas dataframe!')

ngcovid.head(10)
ngcovid.tail()
ngcovid.columns.values
ngcovid.index.values
ngcovid.shape
ngcovid.info()
print(type(ngcovid.columns))
print(type(ngcovid.index))
ngcovid.set_index('State', inplace=True)

# let's view the first five elements and see how the dataframe was changed
ngcovid.head()
ngcovid.shape
ngcovid.sort_values(['Confirmedcases'], ascending=False, axis=0, inplace=True)

# get the top 5 entries
ngcovid_top5 = ngcovid.head()

# transpose the dataframe
#ngcovid_top5 = ngcovid_top5['State'].transpose() 

ngcovid_top5.head()
ngcovid_top5.index = ngcovid_top5.index.map(str) # let's change the index values of ngcovid_top5 to type integer for plotting
ngcovid_top5.plot(kind='area', 
             stacked=False,
             figsize=(20, 10), # pass a tuple (x, y) size
             )

plt.title('Confirmed Cases Trend of Top 5 States')
plt.ylabel('Confirmedcases')
#plt.xlabel('States')

plt.show()
df_confirm = ngcovid[[ 'Confirmedcases']]
df_confirm.sort_values(['State'], ascending=True, axis=0, inplace=True)
df_confirm.head(10)
# get the top 5 entries
df_discharged = ngcovid.head()
df_discharged = ngcovid[['Discharged']]
df_discharged.sort_values(['Discharged'], ascending=False, axis=0, inplace=True)
df_discharged.head()
# step 2: plot data
#plt.xticks(month_num, calendar.month_name[1:13], rotation=20)
df_discharged.index = df_discharged.index.map(str)
df_discharged.plot(kind='bar', figsize=(10, 10))

plt.xlabel('State') # add to x-label to the plot
plt.ylabel('Confirmed cases') # add y-label to the plot
plt.title('Total Confirmed Cases By State') # add title to the plot

plt.show()
# step 2: plot data
#plt.xticks(month_num, calendar.month_name[1:13], rotation=20)
df_confirm.plot(kind='bar', figsize=(10, 10))

plt.xlabel('State') # add to x-label to the plot
plt.ylabel('Confirmed cases') # add y-label to the plot
plt.title('Total Confirmed Cases By State') # add title to the plot

plt.show()
# group countries by continents and apply sum() function 
ngcovid.sort_values(['Confirmedcases'], ascending=False, axis=0, inplace=True)

# get the top 5 entries
ngcovid_top6 = ngcovid.head()
ngcovid_top6 = ngcovid.groupby('State', axis=0).sum()

# note: the output of the groupby method is a `groupby' object. 
# we can not use it further until we apply a function (eg .sum())
print(type(ngcovid.groupby('State', axis=0)))

ngcovid_top6.head()
# autopct create %, start angle represent starting point

ngcovid_top5['Confirmedcases'].plot(kind='pie',
                            figsize=(5, 6),
                            autopct='%1.1f%%', # add in percentages
                            startangle=90,     # start angle 90° (Africa)
                            shadow=True,       # add shadow      
                            )

plt.title('Top 5 Affected State')
plt.axis('equal') # Sets the pie chart to look like a circle.
#plt.savefig('Pie_Opaque.png', dpi=300)

plt.show()
import seaborn as sns
#sns.relplot(x='Month', y='Smoothies', hue='Promotion', style='weekend', dashes=False, markers=True,
            #data=snacks_sales, kind='line', ci=None)
#plt.title('line plot with hue and custom style', size=20, color='g')

#plt.show();
 sngcovid = pd.read_csv('data/scondcovid19.csv')
sngcovid.set_index('Cases', inplace=True)

print ('Data read into a pandas dataframe!')
sngcovid.head()
sngcovid['Total'].plot(kind='pie',
                            figsize=(10, 10),
                            autopct='%1.1f%%', # add in percentages
                            startangle=45,     # start angle 90° (Africa)
                            shadow=False,       # add shadow      
                            )

plt.title('Top 5 Affected State')
plt.axis('equal') # Sets the pie chart to look like a circle.
#plt.savefig('Pie_Opaque.png', dpi=300)

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1265497076023392, 'fraction_numerical': 0.019649122807017545, 'mean_word_length': 3.709251101321586, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '213464', 'license': 'MIT', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1422, 'n_words': 380, 'path': '.ipynb_checkpoints/Nigeria-Covid19-Data-Visualization-checkpoint.ipynb', 'repo_name': 'hikmah94/Nigeria-Covid-19-Data-Visualization', 'size': '4275'}