Created
April 25, 2022 15:34
-
-
Save audhiaprilliant/077723b6bceb29c9d742abbddd3d8d35 to your computer and use it in GitHub Desktop.
Simulation of Monty Hall Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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