79709567

Date: 2025-07-21 19:54:51
Score: 3.5
Natty:
Report link

Understanding the diff. btw 'size()' and 'count()' by implementing 'Wine-Review' example.

At first lets import the dataset, and see how it looks like

enter image description here

  1. the most common diff is count does not include any NaN values, but size does

  2. Type and Dimension:

    the dataset contains a number of tasters,

    Question: How can we check , who are the most common reviewers in the dataset?

    ans:1. count(), 2.size()

    1.count()

    enter image description here

    if you see the o/p , reviews_by_count returns a dataframe, which is ndarray.

    at first we group the data by same taster_name, then for groups contains every columns except in index(taster_name)

    let's see the type:

    enter image description here

    as you see it returns a DataFrame as a object

    2.size()

    enter image description here

    as u see it didn't return any multiple columns , only one column,

    Let's check the type:

    enter image description here

    Well, it returns a series(1D object)

  3. Usage at diff. time****

    Question: What combination of countries and varieties are most common?Create a Series whose index is a MultiIndexof {country, variety} pairs. For example, a pinot noir produced in the US should map to {"US", "Pinot Noir"}.Sort the values in the Series in descending order based on wine count

enter image description here

as we see it returns a DataFrame , where it is a multi index country and variety.

as per the question, we have to sort by values

enter image description here

as you see, i try to implement sort_values() in decending order, at first i did not give any column, so it

throws me error, but in 2nd time i sort respective to price column,

it shows the fundamental structure of count, bco'z it is a ndarray , it needs a specific col among all columns

but in case of size():

enter image description here

as you see it returns only a column,

and we can sort it without passing by='' parameter, bco'z it has only 1 column to sort.

Pls, give a upvote if you like my explanation !!

Reasons:
  • Blacklisted phrase (1): How can we
  • Blacklisted phrase (1): enter image description here
  • Blacklisted phrase (0.5): upvote
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Aniket Biswas