Skip to content

Guides

How do I find how a cricket ground plays in Python?

Average first and second innings totals at a ground by format, how often the side batting first wins, what captains choose at the toss and how often the toss winner wins.

Code verified November 3, 2026. One call to get_venue, 5 credits.

The call

venue is part of the ground or city name. Matches with a rain rule are left out of the averages.

import requests

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.yorkerapi.com/v1/get_venue",
    headers={"x-api-key": API_KEY},
    json={
        "venue": "wankhede",
        "format": "t20",
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

row = data["by_format"][0]
print(data["venues"][0]["name"], row["matches"], "matches")
print("first innings", row["avg_first_innings"], "second", row["avg_second_innings"])
print("batting first won", row["bat_first_win_pct"], "toss winner won", row["toss_winner_win_pct"])

Replace YOUR_API_KEY with a key from your dashboard. Python needs requests and pandas (pip install requests pandas). JavaScript runs on Node 18 or newer, or in the browser.

What comes back

The data object of the response, trimmed to the first rows. Every field is real output from the run above.

{
  "venues": [
    {
      "id": "wankhede-stadium-mumbai",
      "name": "Wankhede Stadium, Mumbai",
      "city": "Mumbai"
    }
  ],
  "by_format": [
    {
      "format": "t20",
      "matches": 183,
      "avg_first_innings": 172,
      "avg_second_innings": 159,
      "won_batting_first": 79,
      "won_bowling_first": 103,
      "toss_winner_won": 95,
      "chose_to_field": 144,
      "draws": 0,
      "first_match": "2008-04-20",
      "last_match": "2026-05-24",
      "bat_first_win_pct": 0.434,
      "toss_winner_win_pct": 0.522
    }
  ],
  "count": 1,
  "note": "Matches with a rain rule are left out of the averages."
}

What to do next

  • get_matches (2 credits). The matches behind the numbers, filtered by venue.
  • get_ratings (2 credits). How strong the two sides are.

More guides

Start with 500 free credits every month

No card. REST or MCP.