Kenya population Analysis
# Kenyan Population Analysis
This Python script analyzes the population of Kenya using web scraping and data visualization techniques.
## Data Source
The population data is scraped from the Worldometers website.
Dependencies
The script requires the following Python libraries:
requests: for making HTTP requests to the website
BeautifulSoup: for parsing the HTML content of the website
pandas: for data manipulation and storage
plotly.express: for creating line, bar, and pie charts
plotly.graph_objects: for customizing the chart layout
You can install these dependencies using pip:
pip install requests beautifulsoup4 pandas plotly
Run the Python script, and it will automatically generate three types of charts:
- Line chart: Shows the Kenyan population from 1960 to 2024
- Bar chart: Displays the Kenyan population growth over the years
- Pie chart: Illustrates the population distribution for the last 10 years
The charts will be displayed using the Plotly library, and you can interact with them, such as zooming, panning, and viewing hover tooltips.
## Features
Web Scraping: The script uses the BeautifulSoup library to extract the population data from the Worldometers website.
Data Manipulation: The script converts the population data into a Pandas DataFrame and performs some basic data cleaning and sorting.
Data Visualization: The script uses the plotly.express and plotly.graph_objects libraries to create line, bar, and pie charts to visualize the Kenyan population data.
Hover Tooltips: The charts include hover tooltips that display the population values with commas for better readability.
## Future Improvements
Incorporate additional data sources to enrich the analysis (e.g., historical GDP, birth/death rates, etc.)
Add more advanced statistical analysis and forecasting models to predict future population trends
Explore interactive dashboards or web applications to present the analysis in a more user-friendly way
## License
This project is licensed under the M …