{"id":20942463,"url":"https://github.com/bdilday/pybbda","last_synced_at":"2025-09-08T05:33:18.314Z","repository":{"id":37623272,"uuid":"204092060","full_name":"bdilday/pybbda","owner":"bdilday","description":"Python Baseball Data and Analysis","archived":false,"fork":false,"pushed_at":"2024-06-29T17:46:48.000Z","size":6063,"stargazers_count":35,"open_issues_count":4,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-30T05:38:00.699Z","etag":null,"topics":["baseball","baseball-analysis-packages","baseball-analytics","baseball-statistics","python"],"latest_commit_sha":null,"homepage":"https://pybbda.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bdilday.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-24T01:21:22.000Z","updated_at":"2025-04-23T06:15:36.000Z","dependencies_parsed_at":"2024-05-03T21:06:13.144Z","dependency_job_id":null,"html_url":"https://github.com/bdilday/pybbda","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":"0.038461538461538436","last_synced_commit":"0b40a8520e7a92234ca46c9ea06f88b1260edba7"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/bdilday/pybbda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdilday%2Fpybbda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdilday%2Fpybbda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdilday%2Fpybbda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdilday%2Fpybbda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdilday","download_url":"https://codeload.github.com/bdilday/pybbda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdilday%2Fpybbda/sbom","scorecard":{"id":229099,"data":{"date":"2025-08-11","repo":{"name":"github.com/bdilday/pybbda","commit":"b5ece30b7e3706aee5ab3a1fd41c38c3e329d3cf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/pythonpackage.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/bdilday/pybbda/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/bdilday/pybbda/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpackage.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/bdilday/pybbda/pythonpackage.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpackage.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/bdilday/pybbda/pythonpackage.yml/main?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating python:3.10 to python:3.10@sha256:4481586e00db3555bc31dc5f83cf5bba63f54555301b685ed7e461eb8f192eb5","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:23","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:24","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:23","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:24","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:36","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"86 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: GHSA-55x5-fj6c-h6m8","Warn: Project is vulnerable to: PYSEC-2021-19 / GHSA-jq4v-f5q6-mjqq","Warn: Project is vulnerable to: PYSEC-2022-230 / GHSA-wrxv-2j5q-m38w","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: GHSA-6p56-wp2h-9hxr","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: GHSA-3c5c-7235-994j","Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq","Warn: Project is vulnerable to: PYSEC-2021-41 / GHSA-3wvg-mj6g-m9cv","Warn: Project is vulnerable to: PYSEC-2020-77 / GHSA-3xv8-3j54-hgrp","Warn: Project is vulnerable to: PYSEC-2020-80 / GHSA-43fq-w8qq-v88h","Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3","Warn: Project is vulnerable to: GHSA-4fx9-vc88-q2xc","Warn: Project is vulnerable to: PYSEC-2021-35 / GHSA-57h3-9rgr-c24m","Warn: Project is vulnerable to: PYSEC-2020-172 / GHSA-5gm3-px64-rw72","Warn: Project is vulnerable to: PYSEC-2021-331 / GHSA-7534-mm45-c74v","Warn: Project is vulnerable to: PYSEC-2021-92 / GHSA-7r7m-5h27-29hp","Warn: Project is vulnerable to: PYSEC-2020-78 / GHSA-8843-m7mw-mxqm","Warn: Project is vulnerable to: PYSEC-2023-227 / GHSA-8ghj-p4vj-mr35","Warn: Project is vulnerable to: PYSEC-2014-87 / GHSA-8m9x-pxwq-j236","Warn: Project is vulnerable to: PYSEC-2022-10 / GHSA-8vj2-vxx3-667w","Warn: Project is vulnerable to: PYSEC-2021-36 / GHSA-8xjq-8fcg-g5hw","Warn: Project is vulnerable to: PYSEC-2016-6 / GHSA-8xjv-v9xq-m5h9","Warn: Project is vulnerable to: PYSEC-2021-42 / GHSA-95q3-8gr9-gm8w","Warn: Project is vulnerable to: PYSEC-2022-168 / GHSA-9j59-75qj-795w","Warn: Project is vulnerable to: PYSEC-2014-10 / GHSA-cfmr-38g9-f2h7","Warn: Project is vulnerable to: PYSEC-2020-76 / GHSA-cqhg-xjhh-p8hf","Warn: Project is vulnerable to: PYSEC-2021-40 / GHSA-f4w8-cv6p-x6r5","Warn: Project is vulnerable to: PYSEC-2021-69 / GHSA-f5g8-5qq7-938w","Warn: Project is vulnerable to: PYSEC-2021-139 / GHSA-g6rj-rv7j-xwp4","Warn: Project is vulnerable to: PYSEC-2015-16 / GHSA-h5rf-vgqx-wjv2","Warn: Project is vulnerable to: PYSEC-2016-5 / GHSA-hggx-3h72-49ww","Warn: Project is vulnerable to: PYSEC-2020-84 / GHSA-hj69-c76v-86wr","Warn: Project is vulnerable to: PYSEC-2016-7 / GHSA-hvr8-466p-75rh","Warn: Project is vulnerable to: PYSEC-2015-15 / GHSA-j6f7-g425-4gmx","Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr","Warn: Project is vulnerable to: PYSEC-2019-110 / GHSA-j7mj-748x-7p78","Warn: Project is vulnerable to: GHSA-jgpv-4h4c-xhw3","Warn: Project is vulnerable to: PYSEC-2022-42979 / GHSA-m2vv-5vj5-2hm7","Warn: Project is vulnerable to: PYSEC-2021-37 / GHSA-mvg9-xffr-p774","Warn: Project is vulnerable to: PYSEC-2020-83 / GHSA-p49h-hjvm-jg3h","Warn: Project is vulnerable to: PYSEC-2022-8 / GHSA-pw3c-h7wp-cvhx","Warn: Project is vulnerable to: PYSEC-2021-93 / GHSA-q5hq-fp76-qmrc","Warn: Project is vulnerable to: PYSEC-2020-82 / GHSA-r7rm-8j6h-r933","Warn: Project is vulnerable to: PYSEC-2014-23 / GHSA-r854-96gq-rfg3","Warn: Project is vulnerable to: PYSEC-2016-8 / GHSA-rwr3-c2q8-gm56","Warn: Project is vulnerable to: PYSEC-2020-81 / GHSA-vcqg-3p29-xw73","Warn: Project is vulnerable to: PYSEC-2020-79 / GHSA-vj42-xq3r-hr3r","Warn: Project is vulnerable to: PYSEC-2021-70 / GHSA-vqcj-wrf2-7v73","Warn: Project is vulnerable to: PYSEC-2016-9 / GHSA-w4vg-rf63-f3j3","Warn: Project is vulnerable to: PYSEC-2014-22 / GHSA-x895-2wrm-hvp7","Warn: Project is vulnerable to: PYSEC-2022-9 / GHSA-xrcv-f9gm-v42c","Warn: Project is vulnerable to: PYSEC-2021-137","Warn: Project is vulnerable to: PYSEC-2021-138","Warn: Project is vulnerable to: PYSEC-2021-317","Warn: Project is vulnerable to: PYSEC-2021-38","Warn: Project is vulnerable to: PYSEC-2021-39","Warn: Project is vulnerable to: PYSEC-2021-94","Warn: Project is vulnerable to: PYSEC-2023-175","Warn: Project is vulnerable to: PYSEC-2021-140 / GHSA-9w8r-397f-prfh","Warn: Project is vulnerable to: PYSEC-2023-117 / GHSA-mrwq-x4v8-fh7p","Warn: Project is vulnerable to: PYSEC-2021-141 / GHSA-pq64-v7f5-gqh8","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: PYSEC-2023-102","Warn: Project is vulnerable to: PYSEC-2023-114","Warn: Project is vulnerable to: PYSEC-2013-22 / GHSA-27x4-j476-jp5f","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2022-43012 / GHSA-r9hx-vwmv-q579","Warn: Project is vulnerable to: GHSA-g7vv-2v7x-gj9p","Warn: Project is vulnerable to: PYSEC-2014-9 / GHSA-57qw-cc2g-pv5p","Warn: Project is vulnerable to: GHSA-pgww-xf46-h92r","Warn: Project is vulnerable to: PYSEC-2018-12 / GHSA-xp26-p53h-6h2p","Warn: Project is vulnerable to: PYSEC-2020-73","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: PYSEC-2019-156 / GHSA-xp76-357g-9wqq","Warn: Project is vulnerable to: PYSEC-2019-124 / GHSA-38fc-9xqv-7f7q","Warn: Project is vulnerable to: PYSEC-2019-123 / GHSA-887w-45rq-vxgf","Warn: Project is vulnerable to: PYSEC-2012-9 / GHSA-hfg2-wf6j-x53p","Warn: Project is vulnerable to: PYSEC-2017-74"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T04:29:15.552Z","repository_id":37623272,"created_at":"2025-08-17T04:29:15.552Z","updated_at":"2025-08-17T04:29:15.552Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274136547,"owners_count":25228397,"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-09-08T02:00:09.813Z","response_time":121,"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":["baseball","baseball-analysis-packages","baseball-analytics","baseball-statistics","python"],"created_at":"2024-11-18T23:27:14.955Z","updated_at":"2025-09-08T05:33:17.928Z","avatar_url":"https://github.com/bdilday.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pybbda\n\n`pybbda` is a package for \nPython Baseball Data and Analysis. \n\n### data\n\n`pybbda` aims to provide a uniform framework for\naccessing baseball data from various sources. \nThe data are exposed as `pandas` `DataFrames`\n\nThe data sources it currently supports are:\n\n* Lahman data\n\n* Baseball Reference WAR\n\n* Fangraphs leaderboards and park factors\n\n* Retrosheet event data\n\n* Statcast pitch-by-pitch data\n\n\n### analysis\n\n`pybbda` also provides analysis tools. \n\nIt currently supports:\n\n* Marcel projections\n\n* Batted ball trajectories\n\n* Run expectancy via Markov chains\n\nThe following are planned for a future release:\n\n* Simulations\n\n* and more...!\n\n## Installation\n\nThis package is available on PyPI, so you can install it with \n`pip`, \n\n```bash\n$ pip install -U pybbda\n```\n\nOr you can install the latest master branch \ndirectly from the github repo using\n`pip`,\n\n```bash\n$ pip install git+https://github.com/bdilday/pybbda.git\n```\n\nor download the source,\n\n```bash\n$ git clone git@github.com:bdilday/pybbda.git\n$ cd pybbda\n$ pip install .\n```\n\n### Requirements\n\nThis package explicitly \nsupports `Python 3.6` and`Python 3.7`. It aims\nto support `Python 3.8` but this is not guaranteed.\nIt explicitly *does not* support any versions \nprior to `Python 3.6`, including`Python 2.7`.\n\n\n### Installing data\n\nThis package ships without any data. Instead it provides tools \nto fetch and store data from a variety of sources. \n\nTo install data you can use the `update` tool in the `pybbda.data.tools`\nsub-module. \n\nExample, \n\n```bash\n$ python -m pybbda.data.tools.update -h\nusage: update.py [-h] [--data-root DATA_ROOT] --data-source\n                 {Lahman,BaseballReference,Fangraphs,retrosheet,all} [--make-dirs]\n                 [--overwrite] [--min-year MIN_YEAR] [--max-year MAX_YEAR]\n                 [--num-threads NUM_THREADS]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --data-root DATA_ROOT\n                        Root directory for data storage\n  --data-source {Lahman,BaseballReference,Fangraphs,retrosheet,all}\n                        Update source\n  --make-dirs           Make root dir if does not exist\n  --overwrite           Overwrite files if they exist\n  --min-year MIN_YEAR   Min year to download\n  --max-year MAX_YEAR   Max year to download\n  --num-threads NUM_THREADS\n                        Number of threads to use for downloads\n\n```\n\nThe data will be downloaded to `--data-root`, which defaults to the \n`PYBBDA_DATA_ROOT`\n\nDetailed instructions are [provided in the documentation](https://pybbda.readthedocs.io/en/stable/)\n\n\n## Example Usage\n\nAfter installing some or all of the data, you can start using the \npackage.\n\nFollowing is an example of accessing Lahman data. \nMore [examples are included in the documentation](https://pybbda.readthedocs.io/en/stable/examples.html)\n\n### Lahman data\n\n```python\n\u003e\u003e\u003e from pybbda.data import LahmanData\n\u003e\u003e\u003e lahman_data = LahmanData()\n\u003e\u003e\u003e batting_df= lahman_data.batting\nINFO:pybbda.data.sources.lahman.data:data:searching for file /home/bdilday/.pybbda/data/Lahman/Batting.csv\n\u003e\u003e\u003e batting_df.head()\n    playerID  yearID  stint teamID lgID   G   AB   R   H  2B  3B  HR   RBI   SB   CS  BB   SO  IBB  HBP  SH  SF  GIDP\n0  abercda01    1871      1    TRO  NaN   1    4   0   0   0   0   0   0.0  0.0  0.0   0  0.0  NaN  NaN NaN NaN   0.0\n1   addybo01    1871      1    RC1  NaN  25  118  30  32   6   0   0  13.0  8.0  1.0   4  0.0  NaN  NaN NaN NaN   0.0\n2  allisar01    1871      1    CL1  NaN  29  137  28  40   4   5   0  19.0  3.0  1.0   2  5.0  NaN  NaN NaN NaN   1.0\n3  allisdo01    1871      1    WS3  NaN  27  133  28  44  10   2   2  27.0  1.0  1.0   0  2.0  NaN  NaN NaN NaN   0.0\n4  ansonca01    1871      1    RC1  NaN  25  120  29  39  11   3   0  16.0  6.0  2.0   2  1.0  NaN  NaN NaN NaN   0.0\n\u003e\u003e\u003e batting_df.groupby(\"playerID\").HR.sum().sort_values(ascending=False)\nplayerID\nbondsba01    762\naaronha01    755\nruthba01     714\nrodrial01    696\nmayswi01     660\n            ... \nmcconra01      0\nmccolal01      0\nmccluse01      0\nmcclula01      0\naardsda01      0\nName: HR, Length: 19689, dtype: int64\n```\n\n\n### CLI tools\n\n#### Run expectancies \n\nThere is a cli tool for computing run expectancies from \nMarkov chains. \n\n```bash\n$ python -m pybbda.analysis.run_expectancy.markov.cli --help\n```\n\nThis Markov chain uses a lineup of \n9 batters instead of assuming each batter has the same characteristics.\nYou can also assign running probabilities, although they apply to \nall batters equally.\n\nYou can assign batting-event probabilities using a sequence of \nprobabilities, or by referencing a player-season with the \nformat `{playerID}_{season}`, where playerID is the \nLahman ID and season is a 4-digit year. For example, to\nrefer to Rickey Henderson's 1982 season, use `henderi01_1982`.\n\nThe lineup is assigned by giving the lineup slot followed by either \n5 probabilities, or a player-season id. The lineup-slot 0 is a code\nto assign all nine batters to this value. Any other specific slots \nwill be filled in as noted.\n\nThe number of outs to model is 3 by default. It can be changed by setting the \nenvironment variable `PYBBDA_MAX_OUTS`.\n\n**Example**: Use a default set of probabilities for all 9 slots with no taking extra bases\n\n```bash\n$ python -m pybbda.analysis.run_expectancy.markov.cli -b 0 0.08 0.15 0.05 0.005 0.03 --running-probs 0 0 0 0 \nmean score per 27 outs = 3.5227\nstd. score per 27 outs = 2.8009\n```\n\n**Example**: Use a default set of probabilities for all 9 slots with default probabilities for taking extra bases\n\n```bash\n$ python -m pybbda.analysis.run_expectancy.markov.cli -b 0 0.08 0.15 0.05 0.005 0.03\nmean score per 27 outs = 4.2242\nstd. score per 27 outs = 3.0161\n```\n**Example**: Use a default set of probabilities for all 9 slots but let \nRickey Henderson 1982 bat leadoff (using 27 outs, instead of 3)\n\n```bash\n$ PYBBDA_MAX_OUTS=27  python -m pybbda.analysis.run_expectancy.markov.cli -b 0 0.08 0.15 0.05 0.005 0.03 -i 1 henderi01_1982\nWARNING:pybbda:__init__:Environment variable PYBBDA_DATA_ROOT is not set, defaulting to /home/bdilday/github/pybbda/pybbda/data/assets\nINFO:pybbda.data.sources.lahman.data:data:searching for file /home/bdilday/github/pybbda/pybbda/data/assets/Lahman/Batting.csv\nmean score per 27 outs = 4.3628\nstd. score per 27 outs = 3.0999\n```\n\n**Example**: Use a default set of probabilities for all 9 slots but let \nRickey Henderson 1982 bat leadoff and Babe Ruth 1927 bat clean-up (using 27 outs, instead of 3)\n\n```bash\n$ PYBBDA_MAX_OUTS=27  python -m pybbda.analysis.run_expectancy.markov.cli -b 0 0.08 0.15 0.05 0.005 0.03 -i 1 henderi01_1982 -i 4 ruthba01_1927 \nWARNING:pybbda:__init__:Environment variable PYBBDA_DATA_ROOT is not set, defaulting to /home/bdilday/github/pybbda/pybbda/data/assets\nINFO:pybbda.data.sources.lahman.data:data:searching for file /home/bdilday/github/pybbda/pybbda/data/assets/Lahman/Batting.csv\nmean score per 27 outs = 5.1420\nstd. score per 27 outs = 3.3996\n```\n\n## Contributing\n\nContributions from the community are welcome. \nSee the [contributing guide](CONTRIBUTING.md).\n\n## License\n\n[GPLv2](https://choosealicense.com/licenses/gpl-2.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdilday%2Fpybbda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdilday%2Fpybbda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdilday%2Fpybbda/lists"}