{"id":23402613,"url":"https://github.com/martincastroalvarez/python-monte-carlo-simulator","last_synced_at":"2026-05-03T20:38:01.708Z","repository":{"id":37604327,"uuid":"188614646","full_name":"MartinCastroAlvarez/python-monte-carlo-simulator","owner":"MartinCastroAlvarez","description":"Monte Carlo simulator in Python.","archived":false,"fork":false,"pushed_at":"2022-06-21T22:01:10.000Z","size":36,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-02T12:48:19.922Z","etag":null,"topics":["monte-carlo-simulation","montecarlo","normal-distribution","numpy","pandas","python","simulation"],"latest_commit_sha":null,"homepage":"https://martincastroalvarez.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MartinCastroAlvarez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-25T21:39:59.000Z","updated_at":"2022-04-04T11:11:17.000Z","dependencies_parsed_at":"2022-09-05T08:21:04.820Z","dependency_job_id":null,"html_url":"https://github.com/MartinCastroAlvarez/python-monte-carlo-simulator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MartinCastroAlvarez/python-monte-carlo-simulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinCastroAlvarez%2Fpython-monte-carlo-simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinCastroAlvarez%2Fpython-monte-carlo-simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinCastroAlvarez%2Fpython-monte-carlo-simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinCastroAlvarez%2Fpython-monte-carlo-simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MartinCastroAlvarez","download_url":"https://codeload.github.com/MartinCastroAlvarez/python-monte-carlo-simulator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinCastroAlvarez%2Fpython-monte-carlo-simulator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32584580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["monte-carlo-simulation","montecarlo","normal-distribution","numpy","pandas","python","simulation"],"created_at":"2024-12-22T12:29:42.866Z","updated_at":"2026-05-03T20:38:01.665Z","avatar_url":"https://github.com/MartinCastroAlvarez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MontePy\n*Monte Carlo simulation using Numpy and Pandas*\n\n![alt text](./dice.jpeg)\n\n## References\n- [Monte Carlo Simulations with Python](https://towardsdatascience.com/monte-carlo-simulations-with-python-part-1-f5627b7d60b0)\n- [Numpy Random Distribution](https://docs.scipy.org/doc/numpy/reference/routines.random.html)\n- [Python Monte Carlo](https://pbpython.com/monte-carlo.html)\n- [Numpy Binomial Distribution](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.binomial.html#numpy.random.binomial)\n- [Numpy Normal Distribution](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html#numpy.random.normal)\n- [Numpy Exponential Distribution](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.exponential.html#numpy.random.exponential)\n- [Pandas Eval](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.eval.html)\n\n## Installation\n```\ngit clone ssh://git@github.com/MartinCastroAlvarez/monte-py\ncd monte-py\nvirtualenv -p python3 env\nsource env/bin/activate\npip install -r requirements.txt\n```\n\n## Usage\nCreate a file called `dataset.json` and put this config inside:\n```\n{\n    \"features\": {\n        \"Sales\": {\n            \"distribution\": \"normal\",\n            \"avg\": 100,\n            \"std\": 0.8,\n            \"min\": 0\n        },\n        \"Price\": {\n            \"distribution\": \"normal\",\n            \"avg\": 10,\n            \"std\": 0.2,\n            \"min\": 0\n        },\n        \"FixedCost\": {\n            \"distribution\": \"normal\",\n            \"avg\": 100,\n            \"std\": 0.5,\n            \"min\": 0\n        },\n        \"VariableCost\": {\n            \"distribution\": \"normal\",\n            \"avg\": 8,\n            \"std\": 2,\n            \"min\": 0\n        }\n    },\n    \"targets\": [{\n        \"Revenue\": \"Price * Sales\",\n        \"Cost\": \"FixedCost + VariableCost * Sales\"\n    }, {\n        \"Profit\": \"Revenue - Cost\"\n    }]\n}\n```\nExecute the following command to run the simulation:\n```\npython3 simulate.py  --simulations 100 --path dataset.json\n```\nLook at the output:\n```\n            Sales       Price   FixedCost  VariableCost      Revenue         Cost      Profit\ncount  100.000000  100.000000  100.000000    100.000000   100.000000   100.000000  100.000000\nmean   100.016270    9.985491   99.940654      7.858189   998.716079   886.028664  112.687415\nstd      0.823051    0.197306    0.485513      1.887991    21.583492   189.225182  189.462751\nmin     97.984897    9.473178   98.542858      3.344354   939.624517   434.246999 -438.177117\n25%     99.490436    9.845898   99.620062      6.867120   983.393390   787.918456  -12.257061\n50%    100.028057    9.989368   99.908596      8.057500   999.504628   906.059768   98.668392\n75%    100.542664   10.142087  100.307828      9.117511  1014.255521  1010.227241  225.900207\nmax    102.427096   10.404904  100.937590     13.529123  1044.997147  1435.870633  526.558347\n```\nIn this example, the expected profit is `$112.687415` after simulating the scenario 100 times.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartincastroalvarez%2Fpython-monte-carlo-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartincastroalvarez%2Fpython-monte-carlo-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartincastroalvarez%2Fpython-monte-carlo-simulator/lists"}