Menu

How do I get tennis Elo ratings by surface in Python?
📰

How do I get tennis Elo ratings by surface in Python?

DEV Community: python·noah·13 days ago
#X77dxHRF
#devtopython#devto#dev#rating#clay
Reading 0:00
15s threshold

Our Elo rating for every active player, overall or on one surface, with the number of matches behind each rating.

Code verified October 10, 2026. It takes one call to get_ratings, 2 credits.

The call

surface is hard, clay or grass. Leave it out for the overall rating. active_since drops players who have stopped playing.

import requests import pandas as pd

API_KEY = " YOUR_API_KEY "

resp = requests . post ( " https://mcp.acesapi.com/v1/get_ratings " , headers = { " x-api-key " : API_KEY }, json = { " surface " : " clay " , " limit " : 20 , }, timeout = 60 , ) resp . raise_for_status () data = resp . json ()[ " data " ]

clay = pd . DataFrame ( data [ " ratings " ]) print ( clay [[ " rank " , " name " , " country " , " rating " , " surface_matches " ]]. head ( 10 )) # 400 rating points is 10-to-1 odds. gap = clay . loc [ 0 , " rating " ] - clay . loc [ 1 , " rating " ] print ( clay . loc [ 0 , " name " ], " beats " , clay .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.