<jupyter_start><jupyter_text>Pandas Assignment 1: Setlements and Demography of Jigawa State Nigeriaby Engr Chid,  28 June 2020This document contain analysis of Jigawa State Demography.In 2006, the Nigeria Government embarked on a national Population Census accross the 36 States of Nigeria. This exercise will help the government to know how to distribute social amenities, campaign for elections and ration scarce resources of the Country.Gigawa State happens to be amoung the states in the north that have high population. They have over 5,000 wardd in over 40 LGAs.The Langitude and Lattitude is also of interest as it varies so much that one can go off Jigawa or be in Jigawa without being sure, if one only relies on Geolocation readings.Given this kind of demographic variations, we want to know the Following:    -What is the total Population of Jigawa State (nigeria)    -What total number of Males and Females in the State    -Which Ward has the Highest and the Lowest Populated wards    -What population distribution is living at the remotest part of the State  The dataThe data consists of total population of the different Wards in Jigawa State. The data Population is split into male and female per ward. The data was taken in August 2006 by the national Population Commission. The data was actually in CSV formart but was converted to XLS format for easier reading.<jupyter_code>from pandas import *
data = read_excel('jigawastategatessettlement.xls')
data<jupyter_output><empty_output><jupyter_text>The range of the problemThe column of interest is the Column Total.<jupyter_code>TotalColumn = data['Total']
Now we cant get the Total population of Jigawa State:
TotalColumn.sum()
Next is to get the Total Population of Males in that State.
TotalMale=data['Male']
TotalMale.sum()
TotalFemale=data['Female']
TotalFemale.sum()
So what percentage of the Population are males?<jupyter_output><empty_output><jupyter_text>Lets use the mean and Median to get the average population of the State.<jupyter_code>TotalColumn.mean()

TotalColumn.median()
Since the mean and median are very close, it means that the population is evenly distributed.<jupyter_output><empty_output><jupyter_text>The most populated WardTo get this valuue, we sort the Population Total column in Ascending order.<jupyter_code>data.sort_values('Total')<jupyter_output><empty_output><jupyter_text>The result indicates that those wards at Low level lands (smaller Longitude and latitude) and more densly populated than those at the highlands and mountain tops (with Higher Latitudes and Longitudes)<jupyter_code>Rate of Males in each Popultion.
We have seen that there are more males than females in Jigawa State. We want to get the rate of males in each Ward.
MaleColumn = data['Male']
Totalcolum = data['Total']
data['MaleRate'] = MaleColumn * 100 / Totalcolum
data
#also the percentage of Males in that state is also important.
perc = TotalMale.sum()*100/TotalColumn.sum()
print(perc)
This lets us kniow that about 49 percent of the population are male.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05060398302317989, 'fraction_numerical': 0.010120796604635978, 'mean_word_length': 5.491525423728813, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '241808', 'license': 'MIT', 'n_tokens_mistral': 878, 'n_tokens_neox': 805, 'n_words': 413, 'path': 'Pandas Assignment-1.ipynb', 'repo_name': 'engrChidi/Pandas-Assignment-II', 'size': '3063'}