All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.
All our activities include solutions with explanations on how they work and why we chose them.
What's the (approximate) probability of two people sharing a birthday in a group of 10 people?
Important: Enter the first two decimals. Example, if the result is 0.0982
, enter 0.98
. If it's 0.1012
, enter 0.10
.
Same as before, with n
= 15.
Now it's time to generalize the probability calculation and create the function birthday_probability
that returns the probability of two people sharing a birthday when in a group of number_of_people
.
Use the column Birth Date
to extract the "Birthday" (just Month and Day) for each player in the format MM-DD
. Example: 08-01
is August, 1st.
You can use the df['Birth Date'].dt.strftime
method, which accepts a "formatting template" which you can use to decide the formatting of the date. Refer to the docs for more details.
It'll look something like:
This first activity will probably be the tougher one, as you have to find a way to answer how many players share a birthday for a given team. This first activity is related to the Atlanta Hawks. Hopefully, once you solve this one, you'll be able to answer the rest of the activities pretty easily.
Note: We're asking for "pairs" of players. Not total players that share birthdays. This would reduce confusion in case of 3 players having the same birthday (which would result in 2 pairs).
In the Dallas Mavericks there are just two players (one pair) that share a birthday. One is J.J. Barea, who's the other one? Enter the full name.