Passenger Survival Rates: Insights from the Titanic Data

Analyze Titanic passenger survival rates by passenger class using Seaborn count plots.

Uncover how passenger class influenced survival rates on the Titanic using data visualization. Understand why class emerges as a significant factor in predictive modeling.

Key Insights

  • A majority of Titanic passengers were third-class travelers; despite their numbers, significantly fewer third-class passengers survived compared to first- and second-class passengers.
  • First-class passengers experienced a survival advantage, being more likely to survive than perish, while third-class passengers overwhelmingly perished.
  • Analyzing passenger class through visualizations like Seaborn's count plots suggests passenger class is a valuable feature for predictive modeling of survival on the Titanic.

Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.

Let's take a look at what we're missing in this graph. We're gonna graph much the same thing, but it's going to be about the passenger's class instead of their, just that they survive or perish. Just like, okay, what is our breakdown by, of our total population by what passenger class they were? Okay.

We're gonna add an axis this time, and we're gonna do that because we're gonna label it this time, that's why we're saving it as a variable. And we'll say, do a town plot where X is now the P class, passenger class value, and our data is still Titanic data. And we can see here, hey, most people were third class, smaller subsection were second class, and there were a few more at first class.

Okay, well, that's helpful and all, but what if we want to make a bar chart from two columns at once? And in this case, what we're gonna say is, okay, but what if we wanna do survived by passenger class? Well, Seaborn has a great way to handle that. What we're gonna do is we're going to make our axis, and it's gonna, we're gonna say count and X is survived. We're graphing survived on the X axis, but we're splitting it off into different hues by passenger class.

Let's see that. Looks like I need to fix that, make that a little bigger. There we go.

All right, so we have this passenger class. These are passenger class one, these are passenger class two, these are passenger class three. That's what they mean by hue.

Data Analytics Certificate: Live & Hands-on, In NYC or Online, 0% Financing, 1-on-1 Mentoring, Free Retake, Job Prep. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

Now we can look at survived and perished by different passenger class. We can see that third class, in terms of who perished, second class, first class were about the same. First class was actually, you know, proportionately much better, but still, you know, around the same compared to third class passengers who perished a lot.

And survived, you know, even though third class passengers were the biggest number, fewer of them survived than first class passengers. And second class passengers did well, too. So yeah, we can also compare these numbers.

First class, then you more likely to survive than perish. Second class, you are a little more likely to have perished than survived. And third class passengers were overwhelmingly perished.

So this seems like this could be an important feature to include. This is the kind of thing that I'm going to talk about in a study where it's like, okay, we should definitely include this. This seems like it might've been predictive and simple.

And help our model to make sense of this and come up with a formula. Let's take a look at a similar thing, survival by gender in the next bit.

Colin Jaffe

Colin Jaffe is a programmer, writer, and teacher with a passion for creative code, customizable computing environments, and simple puns. He loves teaching code, from the fundamentals of algorithmic thinking to the business logic and user flow of application building—he particularly enjoys teaching JavaScript, Python, API design, and front-end frameworks.

Colin has taught code to a diverse group of students since learning to code himself, including young men of color at All-Star Code, elementary school kids at The Coding Space, and marginalized groups at Pursuit. He also works as an instructor for Noble Desktop, where he teaches classes in the Full-Stack Web Development Certificate and the Data Science & AI Certificate.

Colin lives in Brooklyn with his wife, two kids, and many intricate board games.

More articles by Colin Jaffe

How to Learn Machine Learning

Master machine learning with hands-on training. Use Python to make, modify, and test your own machine learning models.

Yelp Facebook LinkedIn YouTube Twitter Instagram