Data Analysis with Python - Data Analysis Exercise 1

Tell us what’s happening:

Which country has the most sales Quantity Sales?
I am not sure if I have miss understood the question, but the given answer will just count how many times each country appeared in the country column, it returns the maximum as United States with value of 39206, I think it is not the right answer. I have different approach, I have grouped the data by the country column and returned the sum of the revenues then sorted the values as a descending order. Am I wrong.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

Data Analysis with Python - Data Analysis Example A

Hey there,

Please update the message to include your code.

When you enter a code, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like
<p> Hi there </p>

Question: Which country has the most sales (quantity of sales)?
Here is the code of my approach.

// most_sales_country = sales.groupby('Country')['Revenue'].sum()
// most_sales_country = most_sales_country.sort_values(ascending= False)
// most_sales_country.head(1)

If you might have not seen the given answer, here is it too.

// sales['Country'].value_counts().head(1)

If I sell 5 items that are $10 each:
I’ve sold a total quantity of 5 sales
I have a total revenue of $50

If I sell 2 items that are $100 each:
I’ve sold a total quantity of 2 sales
I have a total revenue of $200

You are returning the country with the highest revenue.

1 Like

Okay, I got it thank you so much

1 Like