Challenge 7 Megathread

For any and all questions relating to Challenge 7 :point_down: post away!

Okay, I got the answer, but I cannot comprehend how the max number of games played is anything but 38. Can someone please explain. Also the spelling and grammatical errors in these challenges are really bothering me as they stack up day by day.

Great challenge! great puzzle while working with data!

If you make the playoffs, you make it into the ‘after season’ and you play more games than in other seasons.

2 Likes

The pandas will iterate through all the seasons, some seasons could have more then 38 games played and max will return the maximum value.

To show this, just return the series and not append .max() i.e
print(games_played)

1 Like

This question was straightforward, assuming you use the variables already declared.
An example of how to find the min game with red cards you might go:

games_with_red_cards = df['GWRC']
print(games_with_red_cards.min())

Also, a quick review of what the functions provided do.

series.max()    #outputs max value
series.min()    #outputs min value
series.mean()   #outputs average
series.median() #outputs the middle of a sorted list of values. If the length is even, return the average of the middle-est values ie. 3 4 5 6 returns 4.5. If the length is odd, return the middle value: 3 4 5 returns 4
series.mode()   #outputs the most common value
3 Likes

I thought the same thing for a moment. The table shown in the challenge is only part of the data set. I used the print() function to confirm that there are many more rows of data.

Trust the functions!

3 Likes

Thank you for the replies. Is there a way to go back to a completed challenge to play with it more? Or are you stuck once the solution is showing

1 Like

There are no playoffs in La Liga. Those years with more matches were unique because there were 22 teams playing instead of the regular 20.

For a while I thought “1 season” meant the first season and was very confused. Turns out 1. and 4. asks for the max and min out of all seasons.

2 Likes

Hello everyone.

I will be moderating this forum till 10 AM EST.

Feel free to keep the conversation around the challenge alive.

Thanks!

Fun challenge! I enjoy the direction we are taking with moving onto pandas.

2 Likes

I’m also interested in the answer to this question! Is this possible @Kelvine95 or @caroLHL ? (Thanks!)

How To See The Entire Data Set

Use Print() Method
Carousel21 mentioned that you can see the entire dataset by using the print() method. E.g. by doing something like:

print(df)

Use Head() Method
Another way is to pass in the total number of rows (or a larger number than the total) into the head function. E.g. by writing one of the below

df.head(33)

or

df.head(40)

instead of just

df.head()

to get all 33 rows. The reason that df.head() gives only the first 5 rows (row “0” to row “4”) is because 5 is the default number of rows for the head() function.

Head() Function Documentation
Here’s the documentation that explains how the head() function works:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.head.html?highlight=head

3 Likes

This is absolutely correct!

1 Like

When you don’t know sports and English isn’t your primary language all the abreviations of the table mean nothing.

What are:
MP W D L GF GA GD

Is D for Defeat and L for Losses, doesn’t make sense, if it’s both the same.

4 Likes

I think it could be D for Draw

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

MP - Matches Played
W - Won
D - Draw
L - Lost
GF - Goals For
GA - Goals Against
GD - Goal Difference (GF - GA)

2 Likes

I’ve been using replit to run Python and import pandas as pd is returning an error. ModuleNotFoundError: No module named 'pandas'. Is there anything I can do there or does this challenge have to be done on Jupyter?