‫Now that we've got all our tools ready to go, the first step is to load the data in, because without
‫data, how are we supposed to use our tools?
‫Right?
‫So we go here, load data, make a little heading, and then we're going to settle those.
‫DF So DF is usually short for data frame, so don't read CSV because we've got our heart disease CSV
‫folder in our current working directory.
‫We can just go update, read CSV.
‫We're going to pass it.
‫Can we do tab auto complete heart disease CSV, beautiful.
‫And then we're going to have a look at it.
‫Wonderful.
‫That seems like it's imported.
‫Great.
‫We've already had a sneak peek in this before, but we might go do shape.
‫This is going to tell us how many rows and columns there are.
‫So essentially we have 303 examples which is rows and this is column.
‫So this comes in the form of rows columns.
‫Now, once we've got data loaded in.
‫What's next?
‫Well, that comes data exploration a.k.a known as exploratory data analysis or EDA.
‫Once you've imported a dataset, this is where you want to go and start to explore it.
‫Now, there's no set way of doing this, but what you should be trying to do is become more and more
‫familiar with the data so you can compare different columns to each other.
‫Compare them to the target value.
‫Refer back to the data dictionary.
‫Try and figure things out.
‫What your goal is is to become a subject matter expert on the data set that you're working with.
‫So the goal here is to find out more about the data and become a subject matter expert.
‫On the data set you're working with.
‫Now this is because if someone asked you a question about it, you can give them an explanation.
‫And when you start to build models, you can sound check your model to make sure they're not performing
‫too well, such as like overfitting.
‫Or they might be poorly performing, such as unbefitting.
‫Now, since EDA has no really set methodology, what we're going to do will write down a short checklist
‫so we can go, What questions are you trying to solve?
‫So this is back to our problem definition, and then what kind of data do we have and how do we treat
‫different types?
‫So this is like numerical versus categorical.
‫In our case, all the data in our data frame is numerical.
‫Now, remember, these steps aren't just associated with the heart disease data set.
‫They can be applied to almost any data sets.
‫What's missing from the data and how do you deal with it?
‫Step four Where are the outliers and why should you care about them?
‫Now, outliers are values or samples which are so far away from their other samples, like in terms
‫of if you were comparing one sample to another, if one sample was just completely outlandish, it might
‫be an incorrect like sample that someone may have made a mistake when they were logging that, or it
‫may be an incorrect sample, just full stop.
‫Or it may actually be that that's just an outlandish example and it should be included in your data
‫set.
‫Then finally and again, this is a non-exhaustive list.
‫How can you add change or remove features to get more out of your data?
‫So it's kind of like an EDA checklist that you might want to start with as a bare minimum of what we're
‫trying to figure out.
‫How about we do that?
‫So the first thing we might check DF head.
‫Traditional way of looking at a data frame.
‫If we wanted to look at the bottom.
‫We might do detail.
‫Wonderful.
‫And then the next thing, because we're trying to predict this target variable, I probably want to
‫figure out what's some information about that.
‫So we go deaf target, maybe we use this one.
‫Remember, there's two different ways to access columns in data frames.
‫You can go DFG target or DF target as a string we call value counts on that.
‫So we'll go here.
‫Let's find out how many of each class there are.
‫So in our case, if we go back up to our data dictionary, we're trying to figure out what target is.
‫We can say target is have disease or not.
‫So one equals zero equals no.
‫So there we go.
‫So we have 165 examples where someone has heart disease based on their health parameters and 138 examples
‫where someone doesn't have heart disease.
‫And so what we would think here is that this is a relatively balanced problem, meaning that we have
‫quite a similar amount of examples in both classes.
‫So that's a balanced classification problem.
‫And so if we go here, maybe we want to visualize this.
‫So if we go deaf target.
‫Value counts because we're always trying to be as explanatory.
‫We want to explain the data in a way that both we and other people can understand, and visualizations
‫are one of the best ways to do that.
‫So kind of equals maybe a bar graph, and then we'll pass it some fancy colors so that we know this
‫is our graph.
‫We'll trademark these colors gold, light blue, salmon and light blue.
‫Let's see this.
‫I'll put a little semicolon here so that output doesn't come up.
‫There we go.
‫Maybe we could relabel these as something maybe that might involve changing the values in the data frame.
‫We won't do that for now.
‫If we wanted to share this with someone.
‫We could relabel that as a heart disease and know heart disease.
‫The next thing we might want to look at is different information about our dataframe, so we can do
‫that with dfki info.
‫What are the other columns got in them?
‫Are there any missing values?
‫So this is what this is going to tell us.
‫So we have age which is a non null int 64 there's 14 columns, 302 entries, six is int 64 CP what's
‫CP remember we can check our data dictionary, come up here, chest pain type.
‫Okay.
‫Typical angina.
‫Atypical angina.
‫Not actually sure what what angina means.
‫So this is what we're trying to figure out, what our data is all about.
‫So define angina, a condition marked by severe pain in the chest.
‫That makes sense if we're dealing with heart disease data.
‫Okay.
‫So if we come back, see how there's no real structure to this, like we're just kind of jumping back
‫and forth.
‫If it seems like we're bouncing around, it's because we actually are.
‫And another way to see is there any missing values?
‫DF is an A, not some.
‫Because remember, one of our questions in exploratory data analysis is what's missing from the data
‫and how do we deal with it?
‫So are there any missing values?
‫In our case, there's not.
‫So we don't have to do anything about the missing values there.
‫Then if we're still trying to find out more about our data frame, we might do DF describe which is
‫going to give us some numerical values about all of our columns.
‫So we've got count here, which is 303.
‫That's how many rows there are.
‫We get the main value of age, so that means the mean value of all of our patients.
‫Here is 54.
‫We come through here.
‫Okay.
‫It's not too much there that we can really make use of for now.
‫What we might start to do is compare different columns.
‫So we'll probably save that for the next video.
‫So save this one getting too long.
‫So now we've got some quick, quick insights about the data, right.
‫No real structure here.
‫We're just trying to figure out what's going on.
‫We've read the column headings here.
‫We've compared them to our data dictionary.
‫We've seen how many examples of each target there are.
‫In this graph here, this visualization.
‫Now we're going to start to compare different columns and try and get a bit more of an idea of where
‫the patterns are within our data.
‫So let's do that in the next video.