Intro to Pandas for Data Analysis

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?

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 (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

Same as before, with `n`

= 15.

codevalidated

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

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

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

input

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.

Author

This project is part of

Explore other projects