Skip to content

Commit

Permalink
added a script to compute statistics for measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreaubert committed Nov 11, 2024
1 parent a74f527 commit 956b122
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions experimental/measurement_stats.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"metadata": {},
"outputs": [],
"source": [
"from datas import metadata\n"
"from datas import metadata"
]
},
{
Expand Down Expand Up @@ -41,14 +41,13 @@
"brands = []\n",
"reviewers = []\n",
"for speaker, data in info.items():\n",
" brands.append(data['brand'])\n",
" measurements = data['measurements']\n",
" brands.append(data[\"brand\"])\n",
" measurements = data[\"measurements\"]\n",
" for k, m in measurements.items():\n",
" origin = m['origin'].replace('Vendors-', '')\n",
" if origin == 'Misc':\n",
" origin = k.replace('misc-', '').capitalize()\n",
" reviewers.append(origin)\n",
" "
" origin = m[\"origin\"].replace(\"Vendors-\", \"\")\n",
" if origin == \"Misc\":\n",
" origin = k.replace(\"misc-\", \"\").capitalize()\n",
" reviewers.append(origin)"
]
},
{
Expand All @@ -58,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_brands = pd.DataFrame({'brands': brands}).groupby('brands').size().sort_values(ascending=False)"
"df_brands = pd.DataFrame({\"brands\": brands}).groupby(\"brands\").size().sort_values(ascending=False)"
]
},
{
Expand All @@ -68,7 +67,9 @@
"metadata": {},
"outputs": [],
"source": [
"df_reviewers = pd.DataFrame({'reviewer': reviewers}).groupby('reviewer').size().sort_values(ascending=False)\n"
"df_reviewers = (\n",
" pd.DataFrame({\"reviewer\": reviewers}).groupby(\"reviewer\").size().sort_values(ascending=False)\n",
")"
]
},
{
Expand All @@ -90,9 +91,7 @@
"metadata": {},
"outputs": [],
"source": [
"px.bar(\n",
" df_reviewers[:30]\n",
")"
"px.bar(df_reviewers[:30])"
]
},
{
Expand Down

0 comments on commit 956b122

Please sign in to comment.