Skip to main content

ChessData

Tools for analyzing chess data.

Access chess games with public APIs, convert chess formats like PGNs to data-friendly formats like CSVs, and analyze moves with chess engines.

About

Chess is a rich area for data analysis. Records of billions (!) of games are available for free. These can be mined not only for chess insights, but to research other areas of interest including explainable AI, fraud detection, and many others. But chess games are typically not stored in formats suitable for data analysis.

This library contains tools to make it easier to do research with chess data. It allows you to convert PGNs - the most common format for chess games, which is human-readable but poorly suited to data analysis - and converts them to data-friendly formats like CSVs. It also contains utilities for using a chess engine to analyze the quality of moves in large numbers of games.

Install

pip install chessdata

How to use

from chessdata.etf import pgn2df
pgn = open("data/magnus.pgn")
df = pgn2df(pgn)
Event Site Date Round White Black Result BlackElo BlackRatingDiff BlackTitle ECO Termination TimeControl UTCDate UTCTime Variant WhiteElo WhiteRatingDiff WhiteTitle
0 Rated Blitz game https://lichess.org/lAV0T0zl 2021.12.23 ? DrNykterstein may6enexttime 1-0 2974 -2 GM B20 Normal 180+0 2021.12.23 23:28:07 Standard 3212 +2 GM
1 Rated Blitz game https://lichess.org/Nfk9W01S 2021.12.23 ? may6enexttime DrNykterstein 0-1 3209 +3 GM E48 Time forfeit 180+0 2021.12.23 23:21:54 Standard 2977 -3 GM
2 Rated Blitz game https://lichess.org/mpxofZFJ 2021.12.23 ? DrNykterstein may6enexttime 1-0 2979 -2 GM B20 Time forfeit 180+0 2021.12.23 23:15:48 Standard 3207 +2 GM
3 Rated Blitz game https://lichess.org/hjSxkukT 2021.12.23 ? may6enexttime DrNykterstein 0-1 3204 +3 GM E48 Normal 180+0 2021.12.23 23:10:43 Standard 2982 -3 GM
4 Rated Blitz game https://lichess.org/5cgs1l6r 2021.12.23 ? DrNykterstein may6enexttime 1-0 2984 -2 GM B20 Normal 180+0 2021.12.23 23:07:55 Standard 3202 +2 GM

Please see the notebooks for more examples and use cases.

Metadata

Release files for chessdata 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chessdata 0.0.3
File Size Uploaded
chessdata-0.0.3.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chessdata 0.0.3
File Interpreter ABI Platform
chessdata-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / chessdata-0.0.3.tar.gz

Download URL chessdata-0.0.3.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a413851aa93acfd6411cf6711b98bdbb191c6be1f220d03d083fae562f3a6ccc
BLAKE2b-256 checksum
How to use checksums
5aa96680ccd81a59cda97672d5a91728e84eafe8351935bcc469c8d3f3ed3ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.60.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.2

Release files / chessdata-0.0.3-py3-none-any.whl

Download URL chessdata-0.0.3-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b65763e7802d23b5c1a14bc07a95357e4e3a51726ae6f3f51df99e4046b90f5
BLAKE2b-256 checksum
How to use checksums
656e8194db19ae07afb5577a899ddc844a496b3cc32a98bfb34daf498a1b75d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.60.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page