Hey everyone.
So this video is about a little concept that is missing data.
Now you have worked on the tables that are data frames in the pandas.
And I have told you that pandas is used for data analysis.
So what if you are analyzing data and you get something missing like you are getting marks of students
and any student is absent.
So how to deal with that.
So for that one does has some features that are under the missing details and that we are going to cover
here.
So for that let we have an example dictionary that is like a first and then devalues it A will be something
like One two three four and five then we have the B and devalues and b will be like six seven eight
nine and last will be missing and four missing values we use something that is and B dot net that digitize
the missing values.
So come on.
See this one because we are going to use this one again and again here.
Now after B we have C that will be equal to late night after 9 0 9 1 2.
Now this time the well is missing then we have days that will be three four.
Now three values are missing then we have here.
Time after that we have e and own e we have four values missing.
So here just five and then four times and B don't net and go here.
So I do not have now shifted.
Now if you print this one that is first.
Let me pass it to beginning and David we go now.
Here we have these.
And if you print that one you will get a list of this dictionary of decision not to convert this to
string to near doubling just to be dot data frame and then pass deep.
You will get this one and give it into a variable that is made made him.
Now we have def equal to this thing here.
This and end denoting the missing values and here if you notice first one has all the values second
one have one missing.
Then third one have two missing.
Then for three missing then the fourth one as for missing.
Now to deal with them we have few methods with the pandas.
That is first one is like if you want to have all these values whose particular value are missing.
Get out of this table.
Then we use something like that is known as the F to drop any.
And then just pass the X is like if you press Breashears shift them you will get that you require ahead
X is and there are some other things that is how trash about which we are going to discuss later after
this one.
So for Rose you just need to pass X is equal to zero all deals with missing values will be eliminated
from here.
If you pass this one one then you'll get the column which has all the values like this one.
So that's how you can remove the rows and columns in which days and any missing the loop and by default
the X is values zero.
If you do this one you will get a draw in which all the values are irrelevant.
Now if you are something like there's no problem.
If two values are missing all three values are missing and values are missing.
I will not work on them.
So what if you want to work something like this.
Then we have something known as trash that's something like if you need all these value then.
Just like if you did 5 then only the rows in which all the values are available will get there.
If you need something like I can work with three values available so just pass three you will get all
the roads in which at least three values are available.
And if you do something like just one value I can work with that.
You will get the complete table here because all this has at least one value 1 2 2 4 5.
These are not indexes these are the values a B if you have noticed a is equal to 1 2 2 4 5 the values
in which you have any predominant are converted into float but those who do not have any before Lent
are still the integers.
So this is the trash and axes we have done now after that.
But if you want to fill all these values like I need any particular value that is something like 1 in
all this case like if you want to have some analytic based on multiplication then you want to add one
in all the values like multiplication with one cannot affect the values.
So for that one we have another method after this that is known as fill any here.
Drop a drop and feel you have noticed most have any enemies.
These values that we have used there.
So here you use the value that you want to feel like I want to add one then you will get something like
all the men are replaced by one so that's how you can replace the values that are missing in your data
frame.
And if you want to fill all this value by using some particular operations you can also do that one
also like if I need to replace all the values in let me in be that are missing with the average value
that is the most common thing whenever you are working on something like sales or you are working on
margins then you replace the missing values by the average values because the average of all the values
will be equal to prove value so that's approx.
The output expected.
So that's why filling all the items with the average values much more efficient.
So for that if I need to fill all the values missing in B with the average value of b elements then
I will lose something like first pass the B in quotes.
Make sure you are passing the code again because these are indexes.
These are some particular small things in bundles now you may get confused on like weird where the quotes
in comp. So even when you're up to a professional also and even if you're a beginner also it will always
confusing these things.
So make sure to write them on a particular page like they have to our goals and what I do not have to.
So this one this ABC the N E are just the values of the dictionary so their characters.
And you need to pass the quotes here after passing them and then here in full.
And they you need to have value that value will be denoting the value you are feeling like.
We have done one and here if you don't do one in this one then you will get B just be replaced its last
value with one that is this land replaced by one.
And here you can make that mean value like I can do something like the F then here pass again b don't
mean these mean and the functions like the mean are the function littered with these bundles that are
defined under the group by that we are going to learn in the next video and when you do something like
this one here you notice the values replaced by Sandpoint faith.
That is the average of these four.
Like if you tried the average then if I replace the difference that is 5 that is common in all these
after 5 I have one two plus five and we have seven then here plus five three eight here plus four with
five nine here.
So here I have four three two one.
And the original four three two one you will get divided by then you will get seven point five.
That is the average value of this one how four plus three seven plus two eight or nine and then one
and then divided by four point five.
And then we are the difference five.
We get to this end point five.
That's how mean is calculated here and the mean is added with that.
You can also do this thing with any value like if you do with C just do see here you will get the average
of these two one and two average will be one because the values are in for floating point and the download
will be fun approximately twelve point five.
If you do something like Here you are doing with C replacing with C and add Hep B then the average of
B will be added in these values.
So this thing here doesn't depend on this thing here you can add the average of any value you can even
take a variable and take the average of fraud or something like that one and do the same thing after
that.
Here we have it mean and if you do with E like an E.
We have just five and dairy pass e all the values will replaced by Dec. 1 and if you try to do something
like this one here I have to then here I have two you will get at because that thing doesn't work in.
Same with these rows and so make sure just passing the characters that are left in column.
So this one is again a home for you try to replace with the rows let how you can formulate this problem
that adding average or adding some value to details missing values in rows.
So here we are done with the missing values also.
I hope you understand this one and one thing if you do something like this one a you will not get any
value replaced because already feel values will not get replaced just the missing values that are not
available will be replaced.
So done with the missing values.
And thanks for watching.
I was in the next video.