‫Okay.
‫Welcome back.
‫Now, in the last video we went through different data types in PANDAS series and data frames, creating
‫some series in a dataframe, importing data and then exporting data.
‫Now we're going to look at different ways you can describe data in pandas.
‫So we'll make a little heading here.
‫Remember to do that, you can type some markdown if you've never seen markdown before.
‫You can do some research.
‫But to create a heading, you can do two little hashtags and this will all press escape and m shift
‫enter.
‫Now I've got described data in a nice little heading format.
‫This is a great way to break up Jupyter notebooks.
‫So it's communicative.
‫Okay.
‫To the way you call functions.
‫We've already seen this on an example here to CSV on pandas data frames is by pressing the dot notation.
‫So if we go tab it might show us.
‫There we go.
‫Took a little while and I got impatient and press tabbed a lot.
‫It'll show us a few functions here that we can run, but remember, there's a lot here.
‫So in the beginning, don't focus on trying to learn all of these off by heart.
‫Just focus on using the few that we're going through at the moment and then build upon your knowledge
‫as you go.
‫So the first thing we're going to have a look at is how to describe the data types in our data frame.
‫We can do this by typing in D types, so you'll notice some functions have brackets after and some don't
‫like.
‫This one doesn't have brackets over.
‫The difference between these two is this is an attribute.
‫So we type in here attribute whereas a function like car sales.
‫To see a V is a function.
‫So the difference between an attribute and a function is this is going to perform some steps, whereas
‫de types, which is an attribute, is just some meta information which is stored about the car sales
‫data frame.
‫So that's the two main things to remember here, the difference between an attribute and a function.
‫We don't want to run this line of code, so we'll comment that out, but we do want to see the D types.
‫So let's do that.
‫Hitting shift enter.
‫Now this will tell us some information about our car sales data frame columns.
‫So it's going to make column, let's view it up here.
‫Make color, odometer doors, price, that's our column names.
‫So this is going to tell us the type of our make column is an object, color is an object, odometer
‫is an int, doors is an integer and price is also an object.
‫Let's have a look at some other things we can do with that data frame car sales columns.
‫Now, is this a function or an attribute?
‫It doesn't have brackets, so it's an attribute.
‫So this is going to tell us our column names is going to return it as a list so you could go car columns
‫equals car sales columns.
‫Hit shift enter.
‫And now you've got your column names stored as a list.
‫So you can perform some operations on this list and then use that later on to manipulate your data frame.
‫But this is just how you access two of the main types of attributes from your data frame.
‫Let's have a look at something else.
‫What about the indexes?
‫So we go car columns index.
‫Oh has no attribute index.
‫Oh, because we typed in car columns.
‫We want our car sales dataframe.
‫There we go.
‫Beautiful.
‫So this is going to say, let's view the data frame here.
‫Carsales is going to say the range of the index starts at zero and stops at ten.
‫Step is one.
‫So zero one, two, three.
‫Okay, that makes sense.
‫Now we've gone through a few different attributes of our dataframe.
‫Let's have a look at some of the functions we can call.
‫Remember, the main difference between a function and an attribute is one doesn't have brackets, attributes
‫don't have brackets, and functions are going to perform some kind of operation.
‫So the first one will have a look at is describe.
‫Now.
‫There we go.
‫What the scribe does is gives us some statistical information about our numeric columns.
‫You might notice why isn't price coming up here?
‫It's a numeric column.
‫So we've got odometer.
‫That means there's ten columns is count.
‫The main is 78,601.
‫So the odometer is how many kilometers a car might have done.
‫And the number of doors to count is ten.
‫Meaning there's ten rows with doors as a column.
‫And the main is for standard deviation is that 0.471405.
‫We've got percentiles here, min and max.
‫But no price.
‫Well, if we come back up here, we can see that the odometer is an integer value and the doors are
‫also an integer value, but the price is an object.
‫Now, that's interesting.
‫Hmm.
‫Maybe when we imported it from our CSV, this cell is formatted differently to these cells.
‫Don't worry.
‫We'll have a look at that in a future video.
‫But something to keep in mind is that describe works on only numeric columns.
‫So let's have a look at something else.
‫Maybe we want info, sales info.
‫And now it's important to remember that these type of description functions.
‫And attributes are some things that you might run through at the very start of exploring a new set of
‫data.
‫So that's what we're doing.
‫We're pretending we've got car sales here and we want to start running functions like info and describe
‫to just start exploring our data and getting some information about it.
‫So what's this going to give us?
‫Let's have a look.
‫Range index, ten entries, 0 to 9.
‫Now info is kind of like.
‫Index combined with daytimes.
‫And so, remember, pandas has many different ways to do similar things.
‫So as you go through and work through, learn more about the library, you'll kind of find a pattern
‫that works for you best.
‫I'm just showing you a broad collection of different, useful functions you can use throughout any type
‫of data analysis.
‫What this is going to tell us is that the mate column has ten non null objects, ten non null objects
‫for color.
‫Same again for the rest of the columns.
‫There's two D types for 64.
‫Yep, that makes sense in 64.
‫In 64 and three for object.
‫Okay.
‫And it's not using very much memory.
‫All right.
‫Let's keep going.
‫Car sales, you can call statistical analysis on your data frame.
‫So car sales don't mean we'll give you the average of your numerical columns.
‫Remember, Price doesn't show up here because it's an object, not a numerical column.
‫And you can even call mean on individual series.
‫So let's make a series called Car Prices Equals PD series.
‫3000.
‫Let's pretend that this is our car prices, that they're not in object format, they're in integer format.
‫And then we go.
‫Car prices mean, well, princes, car princes, which are always a car prince.
‫There we go.
‫So that's going to give us the average of these three numbers here.
‫So it's pretty high there, 38,583 because we had this big value.
‫That's a car, prince car right there.
‫Next one we can have a look at is sum so we can go car sales sum.
‫This is going to sum up all of the different columns value.
‫So this is just really combined what's in the make column, what's in the color column, it's totaled
‫up, how many a domino there is, how many doors there are.
‫It's not really useful calling it on the whole data frame.
‫So maybe we do it on a single column not to select a single column.
‫We'll go through this in the selection video, but to select a single column just to demonstrate it
‫here.
‫Doors sum you type in the name of the column in square brackets as a string and then called sum hit
‫shift enter.
‫And now that's just going to bring the sum down here.
‫Now you can do a fair few different versions of this statistical like not just some you can go mean
‫median and a bunch of others.
‫So I'd suggest if you're practicing, try out a few different statistical functions, even look up the
‫PANDAS documentation for different statistical measures.
‫You can call on different columns.
‫And then finally, if you want one last bit of information about your data, frame is length.
‫So the reason you might want this is say your data frames 200,000 rows and you only wanted to work on
‫a few thousand for an exploratory data analysis.
‫You could figure out the length of the data frame you're currently working on by passing it to Len,
‫and we can see that it is ten rows in our dataframe.
‫We have a look at it one more time.
‫Beautiful.
‫And that's nice and correct.
‫Okay, so that's the end of this describing section.
‫What you can probably do is go through practice running the code yourself and then see if there's any
‫other functions here that you want to try out.
‫Maybe create your own series like this, and then see what statistical values you can find out about
‫your series.
‫But without further ado, I'll see you in the next lecture and we'll look at how to differently view
‫data and select data.