Created
June 3, 2024 09:28
-
-
Save lesteve/749917ab9cbae4e6ad76a25590ba2212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import pandas as pd | |
# Got from this PyPI downloads BigQuery datasets with query | |
# SELECT | |
# REGEXP_EXTRACT(file.version, r'(\d+\.\d+)') as scikit_learn_version, | |
# REGEXP_EXTRACT(details.python, r'(\d+\.\d+)') as python_version, | |
# COUNT(*) as count | |
# FROM | |
# `bigquery-public-data.pypi.file_downloads` | |
# WHERE | |
# TIMESTAMP_TRUNC(timestamp, DAY) = TIMESTAMP("2024-05-29") AND project = 'scikit-learn' | |
# GROUP BY scikit_learn_version, python_version | |
# ORDER BY count DESC | |
pypi_data = """ | |
scikit_learn_version,python_version,count | |
1.0,3.7,739433 | |
1.3,3.8,242040 | |
1.5,3.10,219137 | |
1.5,3.9,188493 | |
0.24,3.8,111113 | |
1.5,3.11,93867 | |
0.23,3.7,77243 | |
1.0,3.9,74923 | |
1.2,3.10,59987 | |
1.5,,51856 | |
1.3,3.10,51134 | |
1.4,3.10,48195 | |
1.5,3.12,47912 | |
1.0,3.10,44390 | |
1.4,3.11,44176 | |
1.1,3.8,40529 | |
0.24,3.7,40027 | |
1.4,,37815 | |
1.0,3.8,35864 | |
1.3,,32951 | |
1.2,3.8,31234 | |
1.1,3.10,30308 | |
1.3,3.11,29907 | |
1.1,3.9,26657 | |
1.2,3.9,25487 | |
1.2,3.11,25295 | |
0.19,3.7,24337 | |
1.3,3.9,23823 | |
0.20,3.7,21831 | |
1.4,3.9,19870 | |
0.24,,17259 | |
0.22,3.8,16620 | |
1.0,,16211 | |
0.24,3.6,15680 | |
1.1,,15679 | |
0.24,3.9,15503 | |
1.2,,14000 | |
0.23,3.8,11121 | |
0.21,3.7,10419 | |
0.20,2.7,10416 | |
1.4,3.12,8632 | |
0.22,3.7,5893 | |
0.23,3.6,5554 | |
0.22,3.5,4991 | |
0.24,3.10,4904 | |
0.20,3.6,3903 | |
0.19,2.7,3600 | |
1.1,3.11,2763 | |
0.20,3.8,2440 | |
0.22,3.9,2256 | |
0.23,3.9,1947 | |
1.3,3.12,1939 | |
0.21,,1271 | |
0.20,,1230 | |
0.21,3.8,1053 | |
0.21,3.5,912 | |
0.23,,793 | |
0.19,3.6,793 | |
0.21,3.6,690 | |
0.22,3.6,637 | |
0.24,3.11,618 | |
0.22,,605 | |
1.0,3.11,584 | |
0.22,3.10,537 | |
0.20,3.9,426 | |
1.2,3.12,422 | |
0.19,3.8,318 | |
0.23,3.10,284 | |
0.18,2.7,238 | |
0.18,3.7,230 | |
0.19,3.9,216 | |
0.22,3.11,194 | |
0.20,3.10,164 | |
0.17,2.7,163 | |
0.17,3.7,150 | |
0.18,3.8,150 | |
0.23,3.11,126 | |
0.21,3.9,112 | |
1.0,3.12,111 | |
0.21,3.10,108 | |
0.24,3.12,105 | |
1.1,3.12,102 | |
1.5,3.7,99 | |
0.19,3.10,92 | |
0.18,3.6,91 | |
0.19,,77 | |
0.19,3.5,67 | |
0.21,3.11,53 | |
0.17,3.6,51 | |
0.17,3.8,50 | |
0.23,3.12,45 | |
1.5,3.8,43 | |
0.18,,38 | |
0.20,3.11,36 | |
0.16,3.7,35 | |
0.18,3.10,35 | |
0.19,3.11,34 | |
0.22,3.12,33 | |
0.21,3.12,31 | |
0.20,3.5,31 | |
0.18,3.9,30 | |
0.15,3.7,28 | |
0.15,3.9,25 | |
0.19,3.12,24 | |
0.16,2.7,23 | |
0.17,3.9,20 | |
0.17,,19 | |
0.18,3.11,19 | |
0.15,3.6,18 | |
0.16,3.9,16 | |
0.15,,16 | |
0.14,3.7,15 | |
0.15,2.7,13 | |
1.5,3.13,11 | |
0.20,3.12,11 | |
0.16,,11 | |
0.14,2.7,10 | |
0.15,3.8,10 | |
0.17,3.5,9 | |
0.17,3.10,8 | |
0.16,3.8,8 | |
1.5,2.7,7 | |
0.15,3.11,7 | |
0.15,3.10,5 | |
0.20,3.4,5 | |
0.12,2.7,4 | |
0.12,3.7,4 | |
0.17,3.11,4 | |
0.14,3.9,4 | |
0.14,3.8,4 | |
0.18,3.12,3 | |
0.10,3.8,3 | |
0.16,3.10,3 | |
0.16,3.11,3 | |
0.17,3.12,2 | |
0.12,3.9,2 | |
0.13,3.9,2 | |
0.13,3.10,2 | |
0.14,3.10,2 | |
0.13,3.8,2 | |
0.16,3.6,2 | |
0.10,3.9,1 | |
0.11,3.9,1 | |
0.9,3.9,1 | |
1.5,3.6,1 | |
0.10,2.7,1 | |
0.10,3.7,1 | |
0.14,3.12,1 | |
0.9,3.12,1 | |
0.13,3.11,1 | |
0.14,3.11,1 | |
0.9,3.8,1 | |
0.14,,1 | |
0.9,3.10,1 | |
0.9,3.11,1 | |
0.24,3.13,1 | |
""" | |
df = pd.read_csv( | |
io.StringIO(pypi_data), dtype={"scikit_learn_version": str, "python_version": str} | |
) | |
pd.pivot_table( | |
df, index="scikit_learn_version", columns="python_version", values="count" | |
).plot.bar(stacked=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment