Skip to content

Commit

Permalink
added a file computing statistics about the measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreaubert committed Nov 10, 2024
1 parent 7884c3d commit 84504d5
Showing 1 changed file with 128 additions and 0 deletions.
128 changes: 128 additions & 0 deletions experimental/measurement_stats.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "e8c267a9-b96c-441a-8cfc-3976060ff078",
"metadata": {},
"outputs": [],
"source": [
"from datas import metadata\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f31f2eaa-08f9-42d3-a87c-5b09c007e7eb",
"metadata": {},
"outputs": [],
"source": [
"info = metadata.speakers_info;"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9b1a2b56-1731-45f1-b6d3-68d9def21cc0",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import plotly.express as px"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bc56e6c2-79d1-4ffa-b626-1f9e850fffd6",
"metadata": {},
"outputs": [],
"source": [
"brands = []\n",
"reviewers = []\n",
"for speaker, data in info.items():\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",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fa51df24-f9be-439b-98c4-0ea6dd3c3d69",
"metadata": {},
"outputs": [],
"source": [
"df_brands = pd.DataFrame({'brands': brands}).groupby('brands').size().sort_values(ascending=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d0101e67-1880-4c4f-be6c-90fec24af52d",
"metadata": {},
"outputs": [],
"source": [
"df_reviewers = pd.DataFrame({'reviewer': reviewers}).groupby('reviewer').size().sort_values(ascending=False)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d30ade40-9547-41cb-9c7c-e5eae298615e",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"px.bar(df_brands[:30])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "75dc8cf5-ccdd-4e49-ae56-699ba4981b9c",
"metadata": {},
"outputs": [],
"source": [
"px.bar(\n",
" df_reviewers[:30]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0e86ca9-1cae-4264-91c3-aa2847325d36",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 84504d5

Please sign in to comment.