Skip to main content

Tools for analyzing chess data

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chessdata-0.0.3.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chessdata-0.0.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file chessdata-0.0.3.tar.gz.

File metadata

  • Download URL: chessdata-0.0.3.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for chessdata-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a413851aa93acfd6411cf6711b98bdbb191c6be1f220d03d083fae562f3a6ccc
MD5 e35581a3d668ac9800e6aaeae908da84
BLAKE2b-256 5aa96680ccd81a59cda97672d5a91728e84eafe8351935bcc469c8d3f3ed3ea1

See more details on using hashes here.

File details

Details for the file chessdata-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: chessdata-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for chessdata-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1b65763e7802d23b5c1a14bc07a95357e4e3a51726ae6f3f51df99e4046b90f5
MD5 413045969522cf238ae3491ab3768e83
BLAKE2b-256 656e8194db19ae07afb5577a899ddc844a496b3cc32a98bfb34daf498a1b75d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page