{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "israeli-perth",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 143,
"id": "accurate-grill",
"metadata": {},
"outputs": [],
"source": [
"pd.options.plotting.backend = \"plotly\""
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "brave-marsh",
"metadata": {},
"outputs": [],
"source": [
"vals = range(21, 25)\n",
"indexes = [0,1,1,1] # first file has no סמל ועדה column\n",
"dfs = [pd.read_csv(f\"{e}.csv\", index_col=i, encoding=\"iso-8859-8\") for e, i in zip(vals, indexes)]\n",
"\n",
"# cleanup NaN columns\n",
"del dfs[2][\"Unnamed: 37\"]\n",
"del dfs[3][\"Unnamed: 46\"]"
]
},
{
"cell_type": "code",
"execution_count": 138,
"id": "ordered-executive",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['סמל ועדה', 'סמל ישוב', 'בזב', 'מצביעים', 'פסולים', 'כשרים', 'אמת', 'ב',\n",
" 'ג', 'ודעם', 'ז', 'זץ', 'ט', 'י', 'יז', 'ינ', 'יף', 'יק', 'יר', 'כ',\n",
" 'כך', 'כן', 'ל', 'מחל', 'מרצ', 'נ', 'ני', 'נר', 'עם', 'פה', 'ףז', 'צי',\n",
" 'צכ', 'צף', 'ץ', 'ק', 'קי', 'קך', 'קץ', 'ר', 'רנ', 'רף', 'רק', 'שס',\n",
" 'ת'],\n",
" dtype='object')\n"
]
}
],
"source": [
"print(dfs[3].keys())"
]
},
{
"cell_type": "code",
"execution_count": 139,
"id": "foreign-segment",
"metadata": {},
"outputs": [],
"source": [
"static_keys = [\"סמל ועדה\", \"שם ישוב\", \"בזב\", \"מצביעים\", \"פסולים\", \"כשרים\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "normal-theology",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 141,
"id": "provincial-cookbook",
"metadata": {},
"outputs": [],
"source": [
"df2 = dfs[2].sort_values(by=['בזב'], ascending=False)[:50]\n",
"df3 = dfs[3].sort_values(by=['בזב'], ascending=False)[:50]"
]
},
{
"cell_type": "code",
"execution_count": 145,
"id": "ceramic-capacity",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "rates=%{x}
likud=%{y}