Challenge 10 Megathread

Thank you. I read it the other way too!

2 Likes

Sorting in pandas:

Example data:

print(df)

        0          1     2
0   354.7      April   4.0
1    55.4     August   8.0
2   176.5   December  12.0
3    95.5   February   2.0
4    85.6    January   1.0
5     152       July   7.0
6   238.7       June   6.0
7   104.8      March   3.0
8   283.5        May   5.0
9   278.8   November  11.0
10  249.6    October  10.0
11  212.7  September   9.0

Sorting by month:

In [18]:
df.sort_values('2')

Out[18]:
        0          1     2
4    85.6    January   1.0
3    95.5   February   2.0
7   104.8      March   3.0
0   354.7      April   4.0
8   283.5        May   5.0
6   238.7       June   6.0
5   152.0       July   7.0
1    55.4     August   8.0
11  212.7  September   9.0
10  249.6    October  10.0
9   278.8   November  11.0
2   176.5   December  12.0

Source:

Question is worded so terribly…

3 Likes

Came here to say this! Had to click on the hint, which clarified what was actually needed. Silver lining is I got to practice a lot of ways to analyze data frames while looking for what I was getting wrong.

1 Like

Got it! It took a while to figure it out.

It would be nice if the question text could be updated to stop all the confusion and frustration. Thanks!

Hi Everyone!

How To Keep Playing With The Data Sets

If you want to know how to keep playing with the data sets after the challenge has been completed/submitted, check out bruvark’s awesome workaround in the below link.

The suggested work around looks daunting and complicated at first, but it’s actually very straightforward. I can try to help anyone that has trouble with this!

1 Like

When using groupby, if the output is not displayed by group of values in the column, what could I do be doing wrong? That is, it did not group values by neighborhood, output displayed each value of neighborhood as a separate row, instead of grouping them by the split constraint

1 Like

There is! Check out the below link for a workaround. It seems complicated or difficult at first, but it’s actually very straightforward! I can help if you want/need any.

Yes, the lack of proofreading is insane. You’d think that would be really important in this area. Anyway, I really appreciate all your helpful comments in these forums.

Maybe Your Code Is Fine
Do you see a neighborhood in more than one row? If each neighborhood is only showing up in one row, than it seems to me that the groupby() method is working just fine.

Possible Source Of Error In Your Code
But if you see the same neighborhood repeated in more than one row, maybe what’s going on is you passed the wrong parameter to the groupby() method.

Solution
If that’s the problem, you need to pass the correct parameter, haha. Wish I could say more, but I think that telling you exactly what column to group by (and therefore what column name to pass to the groupby() method) would be too close to the answer and might get this comment deleted lol. gl! :grimacing:

I did see the same neighborhood repeated in more than one row. I’ll wait to see the solution tomorrow then haha! I think I messed up the syntax. Thank you anyway!

Thank you for this! I was surprised to see my answer incorrect.

Hi Kelvine95. Like other have said, I misread the question and hence answered “incorrectly”. It hurts a bit. Can this challenge be reset?

Hi all, I will be moderating the forum for the next 2 hours. Please let me know if you face any barriers in attempting to complete todays challenge. Also, please remember to not share any answers on this forum.

Denver

Anyone else get caught up on the American spelling of neighbourhood? :sweat_smile: Thankful for descriptive error messages!

3 Likes

**The way this god awfully question is horrendously worded costed one or more of members on my team their points for the day. Everybody was looking for the highest average price and max size in sq ft. Person who worded this should be laid off for a month and for me to provide free ESL lessons.
Refund ASAP please

Hi Paul, thank you for addressing this and sharing this write-up. We appreciate the feedback!

Hi there! Happy to issue a refund. Where should we send the $0 you paid to register for this free challenge? :wink:

Jokes aside, we have no problems acknowledging that there is room for improvement here. We are taking a hard look at upcoming challenges and doing our best to prevent this from happening again.

I can assure you, however, that no one is getting laid off and your generous offer for ESL lessons will not be necessary. At all.

What I understood just by reading the instructions:

Challenge

Which neighborhood has the highest average property price and the highest size_in_sqft?

get A neighborhood that has both conditions. If this was a SQL query:

select neighborhood, ***** avg_price, ***** avg_size
from df
GROUP BY neighborhood
ORDER BY avg_price, avg_size *****

(I censored some parts of the logic).
It could also be understood as avg price & max size.

I just understood that this was not the case by testing the answers. Please fix the writing of your questions. This could make people fail their first 2 attempts. I’m aware of these mistakes in the instructions, so I test them many times before submitting them. I’m just assuming that instructions_wrong=True by default.