Skip to content

Commit

Permalink
add the legco voting frequency hist
Browse files Browse the repository at this point in the history
  • Loading branch information
hupili committed Apr 30, 2015
1 parent 32b3a68 commit 5bb4c3a
Showing 1 changed file with 49 additions and 40 deletions.
89 changes: 49 additions & 40 deletions Timed Analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1128,50 +1128,14 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 65,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2013-01-26 21\n",
"2013-02-26 24\n",
"2013-03-26 24\n",
"2013-04-26 24\n",
"2013-05-26 1\n",
"2013-06-26 1\n",
"2013-07-26 1\n",
"2013-08-26 1\n",
"2013-09-26 1\n",
"2013-10-26 1\n",
"2013-11-26 1\n",
"2013-12-26 1\n",
"2014-01-26 1\n",
"2014-02-26 1\n",
"2014-03-26 1\n",
"2014-04-26 1\n",
"2014-05-26 4\n",
"2014-06-26 1\n",
"2014-07-26 1\n",
"2014-08-26 1\n",
"2014-09-26 1\n",
"2014-10-26 1\n",
"2014-11-26 1\n",
"2014-12-26 1\n",
"2015-01-26 1\n",
"2015-02-26 1\n",
"Name: 梁國雄, dtype: float64"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"rankings.T['梁國雄']"
"rankings.T[['梁國雄', '曾鈺成']].plot()\n",
"plt.show()"
]
},
{
Expand Down Expand Up @@ -1241,6 +1205,51 @@
"len(legco_df_selected['member_id'].unique())"
]
},
{
"cell_type": "code",
"execution_count": 96,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"legco_df_selected.index = legco_df_selected['dt'].values\n",
"vote_num = legco_df_selected.resample('1w', how='count')\n",
"vote_num[['vote']].plot()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 110,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.664852255054\n",
"0.753575357536\n"
]
}
],
"source": [
"# The volumne at the peak week\n",
"vote_num.sort('dt', ascending=False)\n",
"print 1.0 * vote_num.ix['2014-06-01']['dt'] / vote_num.dt[\n",
" (vote_num.index < datetime.datetime(2014,8,1))\n",
" &\n",
" (vote_num.index >= datetime.datetime(2013,8,31))\n",
"].sum()\n",
"print 1.0 * vote_num.ix['2013-05-19']['dt'] / vote_num.dt[\n",
" (vote_num.index < datetime.datetime(2013,8,1))\n",
" &\n",
" (vote_num.index >= datetime.datetime(2012,8,31))\n",
"].sum()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 5bb4c3a

Please sign in to comment.