Python Open Labs: April 23, 2018

Today was the last Python Open Lab of the semester – congrats to all of the students who have made it this far and picked up skills in a new programming language!

Over the course of the semester, we’ve been learning the basics of Python: how to initialize lists, create dictionaries, iterate through items, and define functions and classes.

The students wanted to see how programming could be applied to a specific problem and how it could be used to analyze existing information or data. I chose to design the last lesson around data visualization. We particularly focused on how to create visualizations using the seaborn library.

The seaborn library is a visualization library based off of matplotlib. It also has the capability to store datasets as dataframes, similar as to how pandas may store an external file. I have recently been exploring seaborn and already find it a very flexible and intuitive library. Borrowing concepts from a tutorial via DataCamp, we were able to create some very beautiful visualizations using only a few lines of code.

Check out some things we were able to make below!

a swarm plot displaying customer tip amounts

a facet grid displaying total bill amounts based on varying aspects of gender and dining time

a colored heat map displaying information related to airplane flights

Students really enjoyed using seaborn and some were even able to apply it to their own datasets. Lots of people were specifically fans of the swarm plots.

Yang Rui (left) and Elena Dubova (right) learning to master seaborn

If you’d like to follow the lesson for today’s class more closely, please click here for step-by-step instructions and enjoy coding things up in your favorite text editor.

Python has become a really popular programming language in the past years. I am glad to see more and more people taking the initiative to learn it and can’t wait to see the amazing challenges my students will take on in the future!

Navie Narula

Leave a Reply

Your email address will not be published. Required fields are marked *