partypy.simulate¶
Module Contents¶
Functions¶
|
Simulate guest attendance at a party. |
-
partypy.simulate.simulate_party(p, n_simulations=500)[source]¶ Simulate guest attendance at a party.
The attendance of each guest is treated as a Bernoulli random variable with probability of attendance p. The total number of attending guests is summed up for each n_simulations.
- Parameters
p (float or array_like of floats) – Probability of guest attendance, >= 0 and <=1.
n_simulations (int, optional) – Number of simulations to run. By default, 500.
- Returns
DataFrame with total number of guests per simulation.
- Return type
pandas.DataFrame
Examples
>>> simulate_party([0.1, 0.5, 0.9], n_simulations=5) Total guests Simulation 1 2 2 2 3 2 4 2 5 2