This is such a good and clear explanation, thank you! Hard to find that on youtube.. Subscribed :)
@DataIndependent
10 ай бұрын
Nice! What was the user case you were doing it for?
@ahlycya
Жыл бұрын
This was amazing I learned so much from you. This was dope! Thank you
@DataIndependent
Жыл бұрын
Nice! Glad that worked out. What else do you wanna see?
@lafcadiothelion
2 жыл бұрын
great explanation and examples
@DataIndependent
2 жыл бұрын
Glad you liked it! Any other videos you'd like to see?
@nomanmalik677
3 жыл бұрын
Thanks a lot sir!, it was really helpful to me
@DataIndependent
3 жыл бұрын
Wonderful! Glad to hear it. Let me know if you need any other help.
@SonuSingh-sn8qg
Жыл бұрын
Super helpful and thanks. One question: How do you plot this on bar chart with bins as x-axis and count as y-axis?
@DataIndependent
Жыл бұрын
Nice - I’m pretty sure you can call .plot() right on your output of the value counts (since it’s a series). Then it’s all the standard charting customizations from there. GL
@SonuSingh-sn8qg
Жыл бұрын
@@DataIndependent thanks for the quick reply.
@afonsoosorio2099
2 жыл бұрын
Sir, This tutorial is great 👍 . Crystal clean and well organized 👌. I would like to count the missing values (NaN) in all dataframe at once or in two steps or chaining, using value_counts. Just like df.info() that returns the non null. I am aware that with (df[columns_name] .value_counts(dropna=False)), I can get the count of missing values included just for one single column. Please assist me if you can. Thank u in advance
@DataIndependent
2 жыл бұрын
Just tried this out and found these worked 1. df.isnull().sum().sum() 2. df.isnull().values.sum() I don't love either one, I wish you could specify a parameter in .sum() to do the whole data frame but it's what it is.
@sibusisofortune738
Жыл бұрын
Great staff thanks. But I have one question, what if you don't want your values to be sorted?
@DataIndependent
Жыл бұрын
hm...what order do you want them in? You can set sort=False if you want
@Mariam.4445
2 жыл бұрын
what of, my column accepts only two values, yet the value counts shows otherwise, ex : the column contains values "fire" and "not fire", yet the value counts kind of separates some "not fire" and "fire", then creates other groups ranging from 1-4 in each, how can I delete those?, because the format and writing looks exactly the same.
@DataIndependent
2 жыл бұрын
It sounds like you may have white space in your dataset? If you wanted to confirm this you could call .unique() on your column. This would show you all the values Pandas thinks are unique. If you wanted to get rid of the whitespace you could call .trim() on your column to remove it.
@Mariam.4445
2 жыл бұрын
@@DataIndependent Thank you !, My friend and I guessed that too, but instead we worked on replacing each word that has white spaces after them, into ones without, and it worked perfectly as well !.
@hardikgupta2765
2 жыл бұрын
How can we count the values of two columns together? For example Liho Liho Restaurant - 2, something like this
@DataIndependent
2 жыл бұрын
hmmmm there are a few ways to go about this. 1. You could concatenate your strings into a single column, then do value counts on that new combined column (not recommended) 2. You could use a group by function and group by your two columns you want (I prefer this one)
@jourymustafa1915
2 жыл бұрын
quick question i have a dataset of nba players and i want how many different teams are in the column what do i use ? pls help
@DataIndependent
2 жыл бұрын
You could do it a bunch of ways, but my favorite would be df['team'].nunique() which is "number of unique" function
@dittprashant
2 жыл бұрын
How can I count specific value?
@DataIndependent
2 жыл бұрын
I would use a filter for this and either .nunique() or count how many rows returned. For example, if you wanted to count how many times "5" appeared in your_column it would be Three ways: 1. sum((df['your_column']==5)) 2. df[df['your_column']==5]['unique_column'].nunique() 3. len(df[df['your_column']==5])
Пікірлер: 25