{"id":28413673,"url":"https://github.com/ranaroussi/pandas-montecarlo","last_synced_at":"2025-07-28T16:08:08.585Z","repository":{"id":40477277,"uuid":"90534057","full_name":"ranaroussi/pandas-montecarlo","owner":"ranaroussi","description":"A lightweight Python library for running simple Monte Carlo Simulations on Pandas Series data","archived":false,"fork":false,"pushed_at":"2018-10-01T11:41:11.000Z","size":372,"stargazers_count":227,"open_issues_count":5,"forks_count":61,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-23T15:46:58.330Z","etag":null,"topics":["monte-carlo","montecarlo","pandas","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ranaroussi.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-07T13:21:12.000Z","updated_at":"2025-07-03T03:47:07.000Z","dependencies_parsed_at":"2022-08-25T23:01:02.852Z","dependency_job_id":null,"html_url":"https://github.com/ranaroussi/pandas-montecarlo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ranaroussi/pandas-montecarlo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranaroussi%2Fpandas-montecarlo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranaroussi%2Fpandas-montecarlo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranaroussi%2Fpandas-montecarlo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranaroussi%2Fpandas-montecarlo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ranaroussi","download_url":"https://codeload.github.com/ranaroussi/pandas-montecarlo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranaroussi%2Fpandas-montecarlo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267543375,"owners_count":24104563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","montecarlo","pandas","python"],"created_at":"2025-06-03T05:19:21.316Z","updated_at":"2025-07-28T16:08:08.577Z","avatar_url":"https://github.com/ranaroussi.png","language":"Python","funding_links":["https://www.patreon.com/aroussi"],"categories":[],"sub_categories":[],"readme":"Monte Carlo Simulator for Pandas Series\n=======================================\n\n.. image:: https://img.shields.io/badge/python-3.4+-blue.svg?style=flat\n    :target: https://pypi.python.org/pypi/pandas-montecarlo\n    :alt: Python version\n\n.. image:: https://img.shields.io/pypi/v/pandas-montecarlo.svg?maxAge=60\n    :target: https://pypi.python.org/pypi/pandas-montecarlo\n    :alt: PyPi version\n\n.. image:: https://img.shields.io/pypi/status/pandas-montecarlo.svg?maxAge=60\n    :target: https://pypi.python.org/pypi/pandas-montecarlo\n    :alt: PyPi status\n\n.. image:: https://img.shields.io/travis/ranaroussi/pandas-montecarlo/master.svg?maxAge=1\n    :target: https://travis-ci.org/ranaroussi/pandas-montecarlo\n    :alt: Travis-CI build status\n\n.. image:: https://img.shields.io/badge/Patreon-accepting-ff69b4.svg?style=flat\n    :target: https://www.patreon.com/aroussi\n    :alt: Patreon Status\n\n.. image:: https://img.shields.io/github/stars/ranaroussi/pandas-montecarlo.svg?style=social\u0026label=Star\u0026maxAge=60\n    :target: https://github.com/ranaroussi/pandas-montecarlo\n    :alt: Star this repo\n\n.. image:: https://img.shields.io/twitter/follow/aroussi.svg?style=social\u0026label=Follow\u0026maxAge=60\n    :target: https://twitter.com/aroussi\n    :alt: Follow me on twitter\n\n\\\n\n**pandas-montecarlo** is a lightweight Python library for running simple\n`Monte Carlo Simulations \u003chttps://en.wikipedia.org/wiki/Monte_Carlo_method\u003e`_ on Pandas Series data.\n\n`Changelog » \u003c./CHANGELOG.rst\u003e`__\n\n-----\n\nQuick Start\n-----------\n\nLet's run a monte carlo simulation on the returns of `SPY \u003chttps://finance.yahoo.com/quote/SPY\u003e`_ (S\u0026P 500 Spider ETF).\n\nFirst, let's download SPY's data and calculate the daily returns.\n\n.. code:: python\n\n    from pandas_datareader import data\n\n    df = data.get_data_yahoo(\"SPY\")\n    df['return'] = df['Adj Close'].pct_change().fillna(0)\n\nNext, we'll import ``pandas_montecarlo`` and run monte carlo simulation\nwith 10 simulations (for demo simplifications) and bust/max drawdown set to ``-10.0%``\nand goal threshhold set to ``+100.0%`` (defaults is ``\u003e=0%``):\n\n.. code:: python\n\n    import pandas_montecarlo\n    mc = df['return'].montecarlo(sims=10, bust=-0.1, goal=1)\n\n\n**Plot simulations**\n\n.. code:: python\n\n    mc.plot(title=\"SPY Returns Monte Carlo Simulations\")  # optional: , figsize=(x, y)\n\n.. image:: https://raw.githubusercontent.com/ranaroussi/pandas-montecarlo/master/demo.png\n   :width: 640 px\n   :height: 360 px\n   :alt: demo\n\n\n**Show test stats**\n\n.. code:: python\n\n    print(mc.stats)\n\n    # prints\n    {\n        'min':    0.98088401987146789,\n        'max':    0.98088401987146934,\n        'mean':   0.98088401987146911,\n        'median': 0.98088401987146911,\n        'std':    4.0792198665315552e-16,\n        'maxdd': -0.17221175099828012,  # max drawdown\n        'bust':   0.2,  # probability of going bust\n        'goal':   0.0   # probability of reaching 100% goal\n    }\n\n**Show bust / max drawdown stats**\n\n.. code:: python\n\n    print(mc.maxdd)\n\n    # prints\n    {\n        'min':    -0.27743285515585991,\n        'max':    -0.00031922711279186444,\n        'mean':   -0.07888087155686732,\n        'median': -0.06010335858432081,\n        'std':     0.062172124557467685\n    }\n\n**Access raw simulations' DataFrame**\n\n.. code:: python\n\n    print(mc.data.head())\n\n.. code:: text\n\n        original          1          2          3          4  ...       10\n    0   0.000000   0.017745  -0.002586  -0.005346  -0.042107  ...  0.00139\n    1   0.002647   0.000050   0.000188   0.010141   0.007443  ...  0.00108\n    2   0.000704   0.002916   0.005324   0.000073  -0.003238  ...  0.00071\n    3   0.004221   0.008564   0.001397   0.007950  -0.006392  ...  0.00902\n    4   0.003328  -0.000511   0.005123   0.013491  -0.005105  ...  0.00252\n\n\nInstallation\n------------\n\nInstall ``pandas_montecarlo`` using ``pip``:\n\n.. code:: bash\n\n    $ pip install pandas_montecarlo --upgrade --no-cache-dir\n\nRequirements\n------------\n\n* `Python \u003chttps://www.python.org\u003e`_ \u003e=3.4\n* `Pandas \u003chttps://github.com/pydata/pandas\u003e`_ (tested to work with \u003e=0.18.1)\n* `Matplotlib \u003chttps://matplotlib.org\u003e`_ (tested to work with \u003e=1.5.3)\n\n\nLegal Stuff\n------------\n\n**pandas-montecarlo** is distributed under the **GNU Lesser General Public License v3.0**. See the `LICENSE.txt \u003c./LICENSE.txt\u003e`_ file in the release for details.\n\n\nP.S.\n------------\n\nPlease drop me an note with any feedback you have.\n\n**Ran Aroussi**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franaroussi%2Fpandas-montecarlo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Franaroussi%2Fpandas-montecarlo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franaroussi%2Fpandas-montecarlo/lists"}