Worldwide users of plastic are leaving a negative impact on the oceans and wildlife all around the world. In this article, I will take you through plastic users analysis with Python which is a very simple task of data analysis for beginners.
Plastic Users Analysis
As this is a beginner level task based on data analysis with Python, so I will only use 3 Python libraries here. Pandas for data handling, NumPy for numerical calculations and Matplotlib for data visualization.
Now let’s import all these libraries and get started with the task to analyse the plastic users with Python:
I will analyse the plastics users based on how much a country uses plastic for the packaging of its food products. So the data I am using is based on food facts which can be easily downloaded from here.
Now let’s import the data and move further with the task of Plastic users analysis with Python:
Now before moving further let’s have a quick look at how our data looks like so that we could know what we are going to work with. I will use the pandas.head() method to look at the first 20 rows in the dataset:
manufacturing_places packaging_tags 137 Canada plastic 397 china plastic 478 uk plastic 629 USA plastic 735 Crèmerie Soignon,Poitou-Charente,France plastic 771 Royaume-Uni plastique 964 United States plastic 967 États-Unis plastique 992 United States plastic 1001 United States plastic 1254 États-Unis plastique 1403 Mexico plastic 1438 Ravens Oak Dairy,Nantwich,Cheshire,England,Uni... plastic 1440 Thailand plastic 1519 Ireland plastique 1806 Moray,United Kingdom plastic 1897 Canada plastic 2075 Switzerland plastic 2079 Canada plastic 2223 Switzerland plastic
Hopefully, this dataset does not contain any missing values. So we can move further to analyze the plastic users without any data preparation and cleaning. Now to analyze the worldwide plastics users let’s sort the countries according to their usage of plastic to pack food products:
Australia 153 France 146 Allemagne 24 Belgique 22 Germany 14 Italie 12 Italy 10 United Kingdom 9 Union Européenne 9 United States 9 Name: manufacturing_places, dtype: int64
The output shows that Australia is the biggest user of plastic. To get more detailed insights, let’s prepare the data and visualize it in the form of a bar plot by using the matplotlib library in Python. I will also annotate the graph that will highlight the biggest user of plastic by using an arrow.
Let’s see how to visualize the bar plot with a text annotation:
So this is how to analyze such data with a text annotation by using the Python programming language. I hope you liked this article on Plastic users analysis with Python. Feel free to ask your valuable questions in the comments section below.