The Birthday Paradox in the NBA
The Birthday Paradox in the NBA Data Science Project
Intro to Pandas for Data Analysis

The Birthday Paradox in the NBA

The Birthday problem asks the question of "What's the probability of 2 people sharing a birthday, in a room with N people?" The birthday paradox refers to the counterintuitive fact that only 23 people are needed for that probability to exceed 50%. In this project, we'll be using Pandas to answer the question: How many players in each team in the NBA share a birthday?
Start this project
The Birthday Paradox in the NBAThe Birthday Paradox in the NBA
Project Created by

Santiago Basulto

Project Activities

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.

input

What's the probability when `n` = 10?

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.

input

What's the probability when `n` is 15?

Same as before, with n = 15.

codevalidated

Write the function `birthday_probability`

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.

codevalidated

Create the column `Birthday` in the `df`

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:

input

How many pairs of players share a birthday for the **Atlanta Hawks**?

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).

input

How many pairs of players share a birthday in the **Cleveland Cavaliers**

input

In the **Dallas Mavericks**, who shares a birthday with *J.J. Barea*?

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.

The Birthday Paradox in the NBAThe Birthday Paradox in the NBA
Project Created by

Santiago Basulto

This project is part of

Intro to Pandas for Data Analysis

Explore other projects