BW #65: Microplastics

BW #65: Microplastics

Remember, my book "Pandas Workout" is now available, in print, at https://PandasWorkout.com ! Use coupon code "pblerner2" through May 10th for a 45% discount.

I'll be giving away copies of my books — along with T-shirts and other swag — at PyCon US next week, so if you'll be in Pittsburgh, come and find me at my booth! I’ll be giving a tutorial about decorators on Thursday afternoon and a talk about dates and times in Pandas on Friday, as well. I hope to see you there.

Me, delighted to have received my author copies of Pandas Workout

Earth Day, when many people take a few moments to think about the environment, was a little more than two weeks ago, on April 22nd. On that day, author Eve Schaub published an opinion piece in the Washington Post with the provocative title, "Don’t waste your time recycling plastic" (https://wapo.st/3UxdJQj). Schaub's book, "Year of No Garbage," describes (somewhat obviously) how she and her family tried to create zero waste for an full year. She is an avid fan of recycling... and yet, in this essay, she says that recycling plastic is actually quite bad for the environment.

This didn't come as a complete surprise. Several years ago, I heard a report on NPR (https://www.npr.org/2020/09/11/912150085/waste-land) about how the plastic industry was behind the push to recycle plastic, not because it was good for the environment, but because it would encourage people to use plastic.

Schaub's article says that while paper and metal recycling are both effective, recycling plastic means that we make more and more of the stuff every year. The biggest problem? Microplastics (https://en.wikipedia.org/wiki/Microplastics), pieces of plastic smaller than 5 mm, that are easily found in our oceans, in our soil, and even in our bodies.

I thought that it might be interesting (and yes, horrifying) to find out more about microplastics. I looked for data sets having to do with microplastics, and discovered that the National Oceanic and Atmospheric Administration (https://noaa.gov/), via its National Centers for Environmental Information (https://www.ncei.noaa.gov/) has an entire section related to marine microplastics -- that is, microplastics found in water — at https://www.ncei.noaa.gov/products/microplastics .

While researching this week’s issue, I discovered the “Nurdle patrol,” people who search for microplastics on beaches and other places, to rid the world of such garbage.

This week, we'll dig into NOAA's data about microplastics — and along the way, we'll (of course) explore lots of Pandas functionality, too.

Data and six questions

This week's data, as mentioned above, comes from the Marine Microplastics project at NOAA's National Centers for Environmental Information. To get the data, first go to the main microplastics page:

https://www.ncei.noaa.gov/products/microplastics

Then click on the button labeled "Launch Microplastics Map." This will open a new window on this page:

https://experience.arcgis.com/experience/b296879cc1984fda833a8acc93e31476

Click on the "data table" button in the top left. Then click on the "actions" button (looks like four circles) in the top right corner. One available action will be "export," with a submenu. Choose "Export to CSV." That'll give you a file in CSV format.

Here are six questions that I'd like you to answer about this data. Among the learning goals for this week are grouping, pivot tables, plotting, working with dates, and working with text.

I'll be back tomorrow with my detailed solutions, including my Jupyter notebook.

  • Read the CSV file into a data frame, ensuring that the "Date" column is treated as a "datetime" dtype.
  • Create a line plot showing, in each year, how many measurements were performed. Now recreate the plot with a separate line for each ocean. What do you notice about the plot?