Skip to content

Instantly share code, notes, and snippets.

@audhiaprilliant
Created April 25, 2022 15:34
Show Gist options
  • Select an option

  • Save audhiaprilliant/077723b6bceb29c9d742abbddd3d8d35 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/077723b6bceb29c9d742abbddd3d8d35 to your computer and use it in GitHub Desktop.
Simulation of Monty Hall Problem
# Perform a empirical simulation
data_general = monty_hall(
num_iter = 1000,
switch = True
)
# Create a data rame
df_general = pd.DataFrame(
data = data_general
)
# Reshape the data
df_general = pd.melt(
frame = df_general,
id_vars = 'iter',
var_name = 'status',
value_name = 'value'
)
# Show data frame
df_general.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment