Analyze survival data from the Titanic disaster using Python and Seaborn. Learn how passenger class influenced survival rates through clear visualizations and code examples.
Key Insights
- The dataset analysis revealed 342 passengers survived while 549 perished on the Titanic.
- Visualization using Seaborn's count plot clearly demonstrates the significant difference in survival numbers, with notably more passengers perishing than surviving.
- The next analytical step involves examining passenger class data (first, second, third) to understand how class distribution correlates with survival rates.
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 start taking a look at our data, doing some data analysis to figure out what's important here. First, how many people survived or did it? Let's write some quick code to just check that. Let's check the survived value counts.
There we go. All right, so 342 survived, 549 died. Okay.
That's helpful to know. Let's try plotting that. Our next part, we've got the basic plot set up, but we haven't, we just left off the axis, the actual bar here.
So our axis equals, no, I don't think we even need to set it to something. We'll just do a count plot from Seabourn. Our X will be survived, 0 or 1. And the data it'll be based on is our Titanic data.
And we'll label them perished and survived. Let's check that out. There we go.
So this will all visualize a lot more people perished than survived. All right. What about if we're looking at passenger class? If we want to see, okay, well, how did they do, what kind of classes were people in? Were they in first class, second class, third class? What was their overall distribution by that? And we'll take a look at that in our next.