Created
October 30, 2024 12:06
-
-
Save tuokri/d653654e4c354ffa48d3c8f1d7e3577d 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
# MIT License | |
# | |
# Copyright (c) 2024 Tuomo Kriikkula | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
import datetime as dt | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import seaborn as sns | |
# Draw a bar plot of Steam Hardware Survey September 2024 most common graphics cards. | |
# Grab the shs.csv file from https://github.com/jdegene/steamHWsurvey. | |
def main(): | |
sns.set_theme() | |
df = pd.read_csv( | |
"shs.csv", | |
parse_dates=["date"], | |
) | |
df["percentage"] = df["percentage"] * 100 | |
print(df.dtypes) | |
df_sep = df.loc[df["date"] >= dt.datetime(2024, 9, 1)] | |
print("Sep:", len(df_sep)) | |
cutoff_pct = 0.5 | |
df_sep_gpus = df_sep.loc[df_sep["category"] == "Video Card Description"] | |
print("Sep GPUs:", len(df_sep_gpus)) | |
others = df_sep_gpus.loc[df_sep_gpus["percentage"] < cutoff_pct] | |
print("others:", len(others)) | |
print(others["name"]) | |
gpus = df_sep_gpus["name"] | |
pct = df_sep_gpus["percentage"] | |
print(gpus) | |
print(len(gpus)) | |
gpu_data = { | |
"GPU": gpus, | |
"percentage": pct, | |
} | |
gpu_df = pd.DataFrame(data=gpu_data) | |
gpu_df.sort_values(by="percentage", ascending=False, inplace=True) | |
plt.figure(figsize=(20, 20)) | |
sns.barplot( | |
data=gpu_df, | |
y="GPU", | |
x="percentage", | |
hue="GPU", | |
legend=False, | |
).set( | |
title="Steam Hardware Survey, September 2024 GPUs", | |
xlabel="percentage (%)", | |
) | |
plt.tight_layout() | |
plt.yticks(fontsize=10) | |
plt.savefig("sep_2024_gpus.png") | |
plt.show() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment