{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#so this workbook tries to figure out what the strength of the NDA and UPA political alliances in the Rajya Sabha\n", " #will be given what we know about the strength of the parties in the different state assemblies\n", " #the alliances they are loyal to in those states and at the centre, when the terms of different state assemblies\n", " #are up, when different batches of Rajya Sabha MPs are retiring etc.\n", "\n", "#have put in relevant (and not so relevant!) comments and sources for code snippets below\n", "\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
stateterm_beginsterm_ends
0Andhra Pradesh19-06-20142019-06-18
1Arunachal Pradesh02-06-20142019-06-01
2Assam02-06-20162021-06-01
3Bihar30-11-20152020-11-29
4Chhattisgarh06-01-20142019-01-05
\n", "
" ], "text/plain": [ " state term_begins term_ends\n", "0 Andhra Pradesh 19-06-2014 2019-06-18\n", "1 Arunachal Pradesh 02-06-2014 2019-06-01\n", "2 Assam 02-06-2016 2021-06-01\n", "3 Bihar 30-11-2015 2020-11-29\n", "4 Chhattisgarh 06-01-2014 2019-01-05" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#just want to give a preview of the data files we're using\n", "\n", "import pandas as pd\n", "\n", "df_assembly_dates = pd.read_csv('assembly_end_dates.csv')\n", " #this dataframe has the dates for when the terms for each state assembly will begin and end\n", " #wasn't aware of this earlier, but it seems the Jammu & Kashmir assembly has a six-year term\n", "\n", "df_assembly_dates['term_ends'] = pd.to_datetime(df_assembly_dates['term_ends'], format=\"%d-%m-%Y\").dt.date\n", " #got code above from https://stackoverflow.com/questions/17134716/convert-dataframe-column-type-from-string-to-datetime\n", " #and from https://stackoverflow.com/a/34277514\n", " \n", "df_assembly_dates.head()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
partyfull_formallianceseatsstate
0INCIndian National CongressUPA1Arunachal Pradesh
1BJPBharatiya Janta PartyNDA47Arunachal Pradesh
2PPAPeoples Party Of Arunachal05Arunachal Pradesh
3INDIndependentNDA2Arunachal Pradesh
4VacantVacant01Arunachal Pradesh
\n", "
" ], "text/plain": [ " party full_form alliance seats state\n", "0 INC Indian National Congress UPA 1 Arunachal Pradesh\n", "1 BJP Bharatiya Janta Party NDA 47 Arunachal Pradesh\n", "2 PPA Peoples Party Of Arunachal 0 5 Arunachal Pradesh\n", "3 IND Independent NDA 2 Arunachal Pradesh\n", "4 Vacant Vacant 0 1 Arunachal Pradesh" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_assembly_data = pd.read_csv('assembly_alliances_strength.csv')\n", " #this has details for how many seats each party holds in each state assembly, and which alliance the party is loyal to\n", "\n", "df_assembly_data.head()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
seat_numberstatenotification_dateretirement_datediff_datesparty_shortparty_fullalliancenamecycle_categorynotespoll_notification_url
01Gujarat19-08-20172023-08-182191.0BJPBharatiya Janta PartyNDAIrani, Smt. Smriti ZubinA3 out of 3http://eci.nic.in/eci_main1/current/PN59_14112...
12Gujarat19-08-20172023-08-182191.0BJPBharatiya Janta PartyNDAShah, AmitA3 out of 3http://eci.nic.in/eci_main1/current/PN59_14112...
23Gujarat19-08-20172023-08-182191.0INCIndian National CongressUPAPatel, Shri AhmedA3 out of 3http://eci.nic.in/eci_main1/current/PN59_14112...
34West Bengal19-08-20172023-08-182191.0INCIndian National CongressUPABhattacharya, Shri P.A6 elected, 5 retiringhttp://eci.nic.in/eci_main1/current/PN59_14112...
45West Bengal19-08-20172023-08-182191.0AITCAll India Trinamool Congress0Sen, Ms. DolaA6 elected, 5 retiringhttp://eci.nic.in/eci_main1/current/PN59_14112...
\n", "
" ], "text/plain": [ " seat_number state notification_date retirement_date diff_dates \\\n", "0 1 Gujarat 19-08-2017 2023-08-18 2191.0 \n", "1 2 Gujarat 19-08-2017 2023-08-18 2191.0 \n", "2 3 Gujarat 19-08-2017 2023-08-18 2191.0 \n", "3 4 West Bengal 19-08-2017 2023-08-18 2191.0 \n", "4 5 West Bengal 19-08-2017 2023-08-18 2191.0 \n", "\n", " party_short party_full alliance \\\n", "0 BJP Bharatiya Janta Party NDA \n", "1 BJP Bharatiya Janta Party NDA \n", "2 INC Indian National Congress UPA \n", "3 INC Indian National Congress UPA \n", "4 AITC All India Trinamool Congress 0 \n", "\n", " name cycle_category notes \\\n", "0 Irani, Smt. Smriti Zubin A 3 out of 3 \n", "1 Shah, Amit A 3 out of 3 \n", "2 Patel, Shri Ahmed A 3 out of 3 \n", "3 Bhattacharya, Shri P. A 6 elected, 5 retiring \n", "4 Sen, Ms. Dola A 6 elected, 5 retiring \n", "\n", " poll_notification_url \n", "0 http://eci.nic.in/eci_main1/current/PN59_14112... \n", "1 http://eci.nic.in/eci_main1/current/PN59_14112... \n", "2 http://eci.nic.in/eci_main1/current/PN59_14112... \n", "3 http://eci.nic.in/eci_main1/current/PN59_14112... \n", "4 http://eci.nic.in/eci_main1/current/PN59_14112... " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_rs_data = pd.read_csv('rajya_sabha_alliances_strength.csv')\n", " #this has info for each rajya sabha seat, who holds it, when their term ends, which alliance do they belong to?\n", "\n", "df_rs_data['retirement_date'] = pd.to_datetime(df_rs_data['retirement_date'], format=\"%d-%m-%Y\").dt.date\n", "\n", "df_rs_data.head()" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2017-08-19\n", "2017-08-20\n", "2017-08-21\n", "2017-08-22\n", "2017-08-23\n", "2017-08-24\n", "2017-08-25\n", "2017-08-26\n", "2017-08-27\n", "2017-08-28\n", "2017-08-29\n", "2017-08-30\n", "2017-08-31\n", "2017-09-01\n", "2017-09-02\n", "2017-09-03\n", "2017-09-04\n", "2017-09-05\n", "2017-09-06\n", "2017-09-07\n", "2017-09-08\n", "2017-09-09\n", "2017-09-10\n", "2017-09-11\n", "2017-09-12\n", "2017-09-13\n", "2017-09-14\n", "2017-09-15\n", "2017-09-16\n", "2017-09-17\n", "2017-09-18\n", "2017-09-19\n", "2017-09-20\n", "2017-09-21\n", "2017-09-22\n", "2017-09-23\n", "2017-09-24\n", "2017-09-25\n", "2017-09-26\n", "2017-09-27\n", "2017-09-28\n", "2017-09-29\n", "2017-09-30\n", "2017-10-01\n", "2017-10-02\n", "2017-10-03\n", "2017-10-04\n", "2017-10-05\n", "2017-10-06\n", "2017-10-07\n", "2017-10-08\n", "2017-10-09\n", "2017-10-10\n", "2017-10-11\n", "2017-10-12\n", "2017-10-13\n", "2017-10-14\n", "2017-10-15\n", "2017-10-16\n", "2017-10-17\n", "2017-10-18\n", "2017-10-19\n", "2017-10-20\n", "2017-10-21\n", "2017-10-22\n", "2017-10-23\n", "2017-10-24\n", "2017-10-25\n", "2017-10-26\n", "2017-10-27\n", "2017-10-28\n", "2017-10-29\n", "2017-10-30\n", "2017-10-31\n", "2017-11-01\n", "2017-11-02\n", "2017-11-03\n", "2017-11-04\n", "2017-11-05\n", "2017-11-06\n", "2017-11-07\n", "2017-11-08\n", "2017-11-09\n", "2017-11-10\n", "2017-11-11\n", "2017-11-12\n", "2017-11-13\n", "2017-11-14\n", "2017-11-15\n", "2017-11-16\n", "2017-11-17\n", "2017-11-18\n", "2017-11-19\n", "2017-11-20\n", "2017-11-21\n", "2017-11-22\n", "2017-11-23\n", "2017-11-24\n", "2017-11-25\n", "2017-11-26\n", "2017-11-27\n", "2017-11-28\n", "2017-11-29\n", "2017-11-30\n", "2017-12-01\n", "2017-12-02\n", "2017-12-03\n", "2017-12-04\n", "2017-12-05\n", "2017-12-06\n", "2017-12-07\n", "2017-12-08\n", "2017-12-09\n", "2017-12-10\n", "2017-12-11\n", "2017-12-12\n", "2017-12-13\n", "2017-12-14\n", "2017-12-15\n", "2017-12-16\n", "2017-12-17\n", "2017-12-18\n", "2017-12-19\n", "2017-12-20\n", "2017-12-21\n", "2017-12-22\n", "2017-12-23\n", "2017-12-24\n", "2017-12-25\n", "2017-12-26\n", "2017-12-27\n", "2017-12-28\n", "2017-12-29\n", "2017-12-30\n", "2017-12-31\n", "2018-01-01\n", "2018-01-02\n", "2018-01-03\n", "2018-01-04\n", "2018-01-05\n", "2018-01-06\n", "2018-01-07\n", "2018-01-08\n", "2018-01-09\n", "2018-01-10\n", "2018-01-11\n", "2018-01-12\n", "2018-01-13\n", "2018-01-14\n", "2018-01-15\n", "2018-01-16\n", "2018-01-17\n", "2018-01-18\n", "2018-01-19\n", "2018-01-20\n", "2018-01-21\n", "2018-01-22\n", "2018-01-23\n", "2018-01-24\n", "2018-01-25\n", "2018-01-26\n", "2018-01-27\n", "2018-01-28\n", "2018-01-29\n", "2018-01-30\n", "2018-01-31\n", "2018-02-01\n", "2018-02-02\n", "2018-02-03\n", "2018-02-04\n", "2018-02-05\n", "2018-02-06\n", "2018-02-07\n", "2018-02-08\n", "2018-02-09\n", "2018-02-10\n", "2018-02-11\n", "2018-02-12\n", "2018-02-13\n", "2018-02-14\n", "2018-02-15\n", "2018-02-16\n", "2018-02-17\n", "2018-02-18\n", "2018-02-19\n", "2018-02-20\n", "2018-02-21\n", "2018-02-22\n", "2018-02-23\n", "2018-02-24\n", "2018-02-25\n", "2018-02-26\n", "2018-02-27\n", "2018-02-28\n", "2018-03-01\n", "2018-03-02\n", "2018-03-03\n", "2018-03-04\n", "2018-03-05\n", "2018-03-06\n", "2018-03-07\n", "2018-03-08\n", "2018-03-09\n", "2018-03-10\n", "2018-03-11\n", "2018-03-12\n", "2018-03-13\n", "2018-03-14\n", "2018-03-15\n", "2018-03-16\n", "2018-03-17\n", "2018-03-18\n", "2018-03-19\n", "2018-03-20\n", "2018-03-21\n", "2018-03-22\n", "2018-03-23\n", "2018-03-24\n", "2018-03-25\n", "2018-03-26\n", "2018-03-27\n", "2018-03-28\n", "2018-03-29\n", "2018-03-30\n", "2018-03-31\n", "2018-04-01\n", "2018-04-02\n", "2018-04-03\n", "2018-04-04\n", "2018-04-05\n", "2018-04-06\n", "2018-04-07\n", "2018-04-08\n", "2018-04-09\n", "2018-04-10\n", "2018-04-11\n", "2018-04-12\n", "2018-04-13\n", "2018-04-14\n", "2018-04-15\n", "2018-04-16\n", "2018-04-17\n", "2018-04-18\n", "2018-04-19\n", "2018-04-20\n", "2018-04-21\n", "2018-04-22\n", "2018-04-23\n", "2018-04-24\n", "2018-04-25\n", "2018-04-26\n", "2018-04-27\n", "2018-04-28\n", "2018-04-29\n", "2018-04-30\n", "2018-05-01\n", "2018-05-02\n", "2018-05-03\n", "2018-05-04\n", "2018-05-05\n", "2018-05-06\n", "2018-05-07\n", "2018-05-08\n", "2018-05-09\n", "2018-05-10\n", "2018-05-11\n", "2018-05-12\n", "2018-05-13\n", "2018-05-14\n", "2018-05-15\n", "2018-05-16\n", "2018-05-17\n", "2018-05-18\n", "2018-05-19\n", "2018-05-20\n", "2018-05-21\n", "2018-05-22\n", "2018-05-23\n", "2018-05-24\n", "2018-05-25\n", "2018-05-26\n", "2018-05-27\n", "2018-05-28\n", "2018-05-29\n", "2018-05-30\n", "2018-05-31\n", "2018-06-01\n", "2018-06-02\n", "2018-06-03\n", "2018-06-04\n", "2018-06-05\n", "2018-06-06\n", "2018-06-07\n", "2018-06-08\n", "2018-06-09\n", "2018-06-10\n", "2018-06-11\n", "2018-06-12\n", "2018-06-13\n", "2018-06-14\n", "2018-06-15\n", "2018-06-16\n", "2018-06-17\n", "2018-06-18\n", "2018-06-19\n", "2018-06-20\n", "2018-06-21\n", "2018-06-22\n", "2018-06-23\n", "2018-06-24\n", "2018-06-25\n", "2018-06-26\n", "2018-06-27\n", "2018-06-28\n", "2018-06-29\n", "2018-06-30\n", "2018-07-01\n", "2018-07-02\n", "2018-07-03\n", "2018-07-04\n", "2018-07-05\n", "2018-07-06\n", "2018-07-07\n", "2018-07-08\n", "2018-07-09\n", "2018-07-10\n", "2018-07-11\n", "2018-07-12\n", "2018-07-13\n", "2018-07-14\n", "2018-07-15\n", "2018-07-16\n", "2018-07-17\n", "2018-07-18\n", "2018-07-19\n", "2018-07-20\n", "2018-07-21\n", "2018-07-22\n", "2018-07-23\n", "2018-07-24\n", "2018-07-25\n", "2018-07-26\n", "2018-07-27\n", "2018-07-28\n", "2018-07-29\n", "2018-07-30\n", "2018-07-31\n", "2018-08-01\n", "2018-08-02\n", "2018-08-03\n", "2018-08-04\n", "2018-08-05\n", "2018-08-06\n", "2018-08-07\n", "2018-08-08\n", "2018-08-09\n", "2018-08-10\n", "2018-08-11\n", "2018-08-12\n", "2018-08-13\n", "2018-08-14\n", "2018-08-15\n", "2018-08-16\n", "2018-08-17\n", "2018-08-18\n", "2018-08-19\n", "2018-08-20\n", "2018-08-21\n", "2018-08-22\n", "2018-08-23\n", "2018-08-24\n", "2018-08-25\n", "2018-08-26\n", "2018-08-27\n", "2018-08-28\n", "2018-08-29\n", "2018-08-30\n", "2018-08-31\n", "2018-09-01\n", "2018-09-02\n", "2018-09-03\n", "2018-09-04\n", "2018-09-05\n", "2018-09-06\n", "2018-09-07\n", "2018-09-08\n", "2018-09-09\n", "2018-09-10\n", "2018-09-11\n", "2018-09-12\n", "2018-09-13\n", "2018-09-14\n", "2018-09-15\n", "2018-09-16\n", "2018-09-17\n", "2018-09-18\n", "2018-09-19\n", "2018-09-20\n", "2018-09-21\n", "2018-09-22\n", "2018-09-23\n", "2018-09-24\n", "2018-09-25\n", "2018-09-26\n", "2018-09-27\n", "2018-09-28\n", "2018-09-29\n", "2018-09-30\n", "2018-10-01\n", "2018-10-02\n", "2018-10-03\n", "2018-10-04\n", "2018-10-05\n", "2018-10-06\n", "2018-10-07\n", "2018-10-08\n", "2018-10-09\n", "2018-10-10\n", "2018-10-11\n", "2018-10-12\n", "2018-10-13\n", "2018-10-14\n", "2018-10-15\n", "2018-10-16\n", "2018-10-17\n", "2018-10-18\n", "2018-10-19\n", "2018-10-20\n", "2018-10-21\n", "2018-10-22\n", "2018-10-23\n", "2018-10-24\n", "2018-10-25\n", "2018-10-26\n", "2018-10-27\n", "2018-10-28\n", "2018-10-29\n", "2018-10-30\n", "2018-10-31\n", "2018-11-01\n", "2018-11-02\n", "2018-11-03\n", "2018-11-04\n", "2018-11-05\n", "2018-11-06\n", "2018-11-07\n", "2018-11-08\n", "2018-11-09\n", "2018-11-10\n", "2018-11-11\n", "2018-11-12\n", "2018-11-13\n", "2018-11-14\n", "2018-11-15\n", "2018-11-16\n", "2018-11-17\n", "2018-11-18\n", "2018-11-19\n", "2018-11-20\n", "2018-11-21\n", "2018-11-22\n", "2018-11-23\n", "2018-11-24\n", "2018-11-25\n", "2018-11-26\n", "2018-11-27\n", "2018-11-28\n", "2018-11-29\n", "2018-11-30\n", "2018-12-01\n", "2018-12-02\n", "2018-12-03\n", "2018-12-04\n", "2018-12-05\n", "2018-12-06\n", "2018-12-07\n", "2018-12-08\n", "2018-12-09\n", "2018-12-10\n", "2018-12-11\n", "2018-12-12\n", "2018-12-13\n", "2018-12-14\n", "2018-12-15\n", "2018-12-16\n", "2018-12-17\n", "2018-12-18\n", "2018-12-19\n", "2018-12-20\n", "2018-12-21\n", "2018-12-22\n", "2018-12-23\n", "2018-12-24\n", "2018-12-25\n", "2018-12-26\n", "2018-12-27\n", "2018-12-28\n", "2018-12-29\n", "2018-12-30\n", "2018-12-31\n", "2019-01-01\n", "2019-01-02\n", "2019-01-03\n", "2019-01-04\n", "2019-01-05\n", "2019-01-06\n", "2019-01-07\n", "2019-01-08\n", "2019-01-09\n", "2019-01-10\n", "2019-01-11\n", "2019-01-12\n", "2019-01-13\n", "2019-01-14\n", "2019-01-15\n", "2019-01-16\n", "2019-01-17\n", "2019-01-18\n", "2019-01-19\n", "2019-01-20\n", "2019-01-21\n", "2019-01-22\n", "2019-01-23\n", "2019-01-24\n", "2019-01-25\n", "2019-01-26\n", "2019-01-27\n", "2019-01-28\n", "2019-01-29\n", "2019-01-30\n", "2019-01-31\n", "2019-02-01\n", "2019-02-02\n", "2019-02-03\n", "2019-02-04\n", "2019-02-05\n", "2019-02-06\n", "2019-02-07\n", "2019-02-08\n", "2019-02-09\n", "2019-02-10\n", "2019-02-11\n", "2019-02-12\n", "2019-02-13\n", "2019-02-14\n", "2019-02-15\n", "2019-02-16\n", "2019-02-17\n", "2019-02-18\n", "2019-02-19\n", "2019-02-20\n", "2019-02-21\n", "2019-02-22\n", "2019-02-23\n", "2019-02-24\n", "2019-02-25\n", "2019-02-26\n", "2019-02-27\n", "2019-02-28\n", "2019-03-01\n", "2019-03-02\n", "2019-03-03\n", "2019-03-04\n", "2019-03-05\n", "2019-03-06\n", "2019-03-07\n", "2019-03-08\n", "2019-03-09\n", "2019-03-10\n", "2019-03-11\n", "2019-03-12\n", "2019-03-13\n", "2019-03-14\n", "2019-03-15\n", "2019-03-16\n", "2019-03-17\n", "2019-03-18\n", "2019-03-19\n", "2019-03-20\n", "2019-03-21\n", "2019-03-22\n", "2019-03-23\n", "2019-03-24\n", "2019-03-25\n", "2019-03-26\n", "2019-03-27\n", "2019-03-28\n", "2019-03-29\n", "2019-03-30\n", "2019-03-31\n", "2019-04-01\n", "2019-04-02\n", "2019-04-03\n", "2019-04-04\n", "2019-04-05\n", "2019-04-06\n", "2019-04-07\n", "2019-04-08\n", "2019-04-09\n", "2019-04-10\n", "2019-04-11\n", "2019-04-12\n", "2019-04-13\n", "2019-04-14\n", "2019-04-15\n", "2019-04-16\n", "2019-04-17\n", "2019-04-18\n", "2019-04-19\n", "2019-04-20\n", "2019-04-21\n", "2019-04-22\n", "2019-04-23\n", "2019-04-24\n", "2019-04-25\n", "2019-04-26\n", "2019-04-27\n", "2019-04-28\n", "2019-04-29\n", "2019-04-30\n", "2019-05-01\n", "2019-05-02\n", "2019-05-03\n", "2019-05-04\n", "2019-05-05\n", "2019-05-06\n", "2019-05-07\n", "2019-05-08\n", "2019-05-09\n", "2019-05-10\n", "2019-05-11\n", "2019-05-12\n", "2019-05-13\n", "2019-05-14\n", "2019-05-15\n", "2019-05-16\n", "2019-05-17\n", "2019-05-18\n", "2019-05-19\n", "2019-05-20\n", "2019-05-21\n", "2019-05-22\n", "2019-05-23\n", "2019-05-24\n", "2019-05-25\n", "2019-05-26\n", "2019-05-27\n", "2019-05-28\n", "2019-05-29\n", "2019-05-30\n", "2019-05-31\n", "2019-06-01\n", "2019-06-02\n", "2019-06-03\n", "2019-06-04\n", "2019-06-05\n", "2019-06-06\n", "2019-06-07\n", "2019-06-08\n", "2019-06-09\n", "2019-06-10\n", "2019-06-11\n", "2019-06-12\n", "2019-06-13\n", "2019-06-14\n", "2019-06-15\n", "2019-06-16\n", "2019-06-17\n", "2019-06-18\n", "2019-06-19\n", "2019-06-20\n", "2019-06-21\n", "2019-06-22\n", "2019-06-23\n", "2019-06-24\n", "2019-06-25\n", "2019-06-26\n", "2019-06-27\n", "2019-06-28\n", "2019-06-29\n", "2019-06-30\n", "2019-07-01\n", "2019-07-02\n", "2019-07-03\n", "2019-07-04\n", "2019-07-05\n", "2019-07-06\n", "2019-07-07\n", "2019-07-08\n", "2019-07-09\n", "2019-07-10\n", "2019-07-11\n", "2019-07-12\n", "2019-07-13\n", "2019-07-14\n", "2019-07-15\n", "2019-07-16\n", "2019-07-17\n", "2019-07-18\n", "2019-07-19\n", "2019-07-20\n", "2019-07-21\n", "2019-07-22\n", "2019-07-23\n", "2019-07-24\n", "2019-07-25\n", "2019-07-26\n", "2019-07-27\n", "2019-07-28\n", "2019-07-29\n", "2019-07-30\n", "2019-07-31\n", "2019-08-01\n", "2019-08-02\n", "2019-08-03\n", "2019-08-04\n", "2019-08-05\n", "2019-08-06\n", "2019-08-07\n", "2019-08-08\n", "2019-08-09\n", "2019-08-10\n", "2019-08-11\n", "2019-08-12\n", "2019-08-13\n", "2019-08-14\n", "2019-08-15\n", "2019-08-16\n", "2019-08-17\n", "2019-08-18\n", "2019-08-19\n", "2019-08-20\n", "2019-08-21\n", "2019-08-22\n", "2019-08-23\n", "2019-08-24\n", "2019-08-25\n", "2019-08-26\n", "2019-08-27\n", "2019-08-28\n", "2019-08-29\n", "2019-08-30\n", "2019-08-31\n", "2019-09-01\n", "2019-09-02\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2019-09-03\n", "2019-09-04\n", "2019-09-05\n", "2019-09-06\n", "2019-09-07\n", "2019-09-08\n", "2019-09-09\n", "2019-09-10\n", "2019-09-11\n", "2019-09-12\n", "2019-09-13\n", "2019-09-14\n", "2019-09-15\n", "2019-09-16\n", "2019-09-17\n", "2019-09-18\n", "2019-09-19\n", "2019-09-20\n", "2019-09-21\n", "2019-09-22\n", "2019-09-23\n", "2019-09-24\n", "2019-09-25\n", "2019-09-26\n", "2019-09-27\n", "2019-09-28\n", "2019-09-29\n", "2019-09-30\n", "2019-10-01\n", "2019-10-02\n", "2019-10-03\n", "2019-10-04\n", "2019-10-05\n", "2019-10-06\n", "2019-10-07\n", "2019-10-08\n", "2019-10-09\n", "2019-10-10\n", "2019-10-11\n", "2019-10-12\n", "2019-10-13\n", "2019-10-14\n", "2019-10-15\n", "2019-10-16\n", "2019-10-17\n", "2019-10-18\n", "2019-10-19\n", "2019-10-20\n", "2019-10-21\n", "2019-10-22\n", "2019-10-23\n", "2019-10-24\n", "2019-10-25\n", "2019-10-26\n", "2019-10-27\n", "2019-10-28\n", "2019-10-29\n", "2019-10-30\n", "2019-10-31\n", "2019-11-01\n", "2019-11-02\n", "2019-11-03\n", "2019-11-04\n", "2019-11-05\n", "2019-11-06\n", "2019-11-07\n", "2019-11-08\n", "2019-11-09\n", "2019-11-10\n", "2019-11-11\n", "2019-11-12\n", "2019-11-13\n", "2019-11-14\n", "2019-11-15\n", "2019-11-16\n", "2019-11-17\n", "2019-11-18\n", "2019-11-19\n", "2019-11-20\n", "2019-11-21\n", "2019-11-22\n", "2019-11-23\n", "2019-11-24\n", "2019-11-25\n", "2019-11-26\n", "2019-11-27\n", "2019-11-28\n", "2019-11-29\n", "2019-11-30\n", "2019-12-01\n", "2019-12-02\n", "2019-12-03\n", "2019-12-04\n", "2019-12-05\n", "2019-12-06\n", "2019-12-07\n", "2019-12-08\n", "2019-12-09\n", "2019-12-10\n", "2019-12-11\n", "2019-12-12\n", "2019-12-13\n", "2019-12-14\n", "2019-12-15\n", "2019-12-16\n", "2019-12-17\n", "2019-12-18\n", "2019-12-19\n", "2019-12-20\n", "2019-12-21\n", "2019-12-22\n", "2019-12-23\n", "2019-12-24\n", "2019-12-25\n", "2019-12-26\n", "2019-12-27\n", "2019-12-28\n", "2019-12-29\n", "2019-12-30\n", "2019-12-31\n", "2020-01-01\n", "2020-01-02\n", "2020-01-03\n", "2020-01-04\n", "2020-01-05\n", "2020-01-06\n", "2020-01-07\n", "2020-01-08\n", "2020-01-09\n", "2020-01-10\n", "2020-01-11\n", "2020-01-12\n", "2020-01-13\n", "2020-01-14\n", "2020-01-15\n", "2020-01-16\n", "2020-01-17\n", "2020-01-18\n", "2020-01-19\n", "2020-01-20\n", "2020-01-21\n", "2020-01-22\n", "2020-01-23\n", "2020-01-24\n", "2020-01-25\n", "2020-01-26\n", "2020-01-27\n", "2020-01-28\n", "2020-01-29\n", "2020-01-30\n", "2020-01-31\n", "2020-02-01\n", "2020-02-02\n", "2020-02-03\n", "2020-02-04\n", "2020-02-05\n", "2020-02-06\n", "2020-02-07\n", "2020-02-08\n", "2020-02-09\n", "2020-02-10\n", "2020-02-11\n", "2020-02-12\n", "2020-02-13\n", "2020-02-14\n", "2020-02-15\n", "2020-02-16\n", "2020-02-17\n", "2020-02-18\n", "2020-02-19\n", "2020-02-20\n", "2020-02-21\n", "2020-02-22\n", "2020-02-23\n", "2020-02-24\n", "2020-02-25\n", "2020-02-26\n", "2020-02-27\n", "2020-02-28\n", "2020-02-29\n", "2020-03-01\n", "2020-03-02\n", "2020-03-03\n", "2020-03-04\n", "2020-03-05\n", "2020-03-06\n", "2020-03-07\n", "2020-03-08\n", "2020-03-09\n", "2020-03-10\n", "2020-03-11\n", "2020-03-12\n", "2020-03-13\n", "2020-03-14\n", "2020-03-15\n", "2020-03-16\n", "2020-03-17\n", "2020-03-18\n", "2020-03-19\n", "2020-03-20\n", "2020-03-21\n", "2020-03-22\n", "2020-03-23\n", "2020-03-24\n", "2020-03-25\n", "2020-03-26\n", "2020-03-27\n", "2020-03-28\n", "2020-03-29\n", "2020-03-30\n", "2020-03-31\n", "2020-04-01\n", "2020-04-02\n", "2020-04-03\n", "2020-04-04\n", "2020-04-05\n", "2020-04-06\n", "2020-04-07\n", "2020-04-08\n", "2020-04-09\n", "2020-04-10\n", "2020-04-11\n", "2020-04-12\n", "2020-04-13\n", "2020-04-14\n", "2020-04-15\n", "2020-04-16\n", "2020-04-17\n", "2020-04-18\n", "2020-04-19\n", "2020-04-20\n", "2020-04-21\n", "2020-04-22\n", "2020-04-23\n", "2020-04-24\n", "2020-04-25\n", "2020-04-26\n", "2020-04-27\n", "2020-04-28\n", "2020-04-29\n", "2020-04-30\n", "2020-05-01\n", "2020-05-02\n", "2020-05-03\n", "2020-05-04\n", "2020-05-05\n", "2020-05-06\n", "2020-05-07\n", "2020-05-08\n", "2020-05-09\n", "2020-05-10\n", "2020-05-11\n", "2020-05-12\n", "2020-05-13\n", "2020-05-14\n", "2020-05-15\n", "2020-05-16\n", "2020-05-17\n", "2020-05-18\n", "2020-05-19\n", "2020-05-20\n", "2020-05-21\n", "2020-05-22\n", "2020-05-23\n", "2020-05-24\n", "2020-05-25\n", "2020-05-26\n", "2020-05-27\n", "2020-05-28\n", "2020-05-29\n", "2020-05-30\n", "2020-05-31\n", "2020-06-01\n", "2020-06-02\n", "2020-06-03\n", "2020-06-04\n", "2020-06-05\n", "2020-06-06\n", "2020-06-07\n", "2020-06-08\n", "2020-06-09\n", "2020-06-10\n", "2020-06-11\n", "2020-06-12\n", "2020-06-13\n", "2020-06-14\n", "2020-06-15\n", "2020-06-16\n", "2020-06-17\n", "2020-06-18\n", "2020-06-19\n", "2020-06-20\n", "2020-06-21\n", "2020-06-22\n", "2020-06-23\n", "2020-06-24\n", "2020-06-25\n", "2020-06-26\n", "2020-06-27\n", "2020-06-28\n", "2020-06-29\n", "2020-06-30\n", "2020-07-01\n", "2020-07-02\n", "2020-07-03\n", "2020-07-04\n", "2020-07-05\n", "2020-07-06\n", "2020-07-07\n", "2020-07-08\n", "2020-07-09\n", "2020-07-10\n", "2020-07-11\n", "2020-07-12\n", "2020-07-13\n", "2020-07-14\n", "2020-07-15\n", "2020-07-16\n", "2020-07-17\n", "2020-07-18\n", "2020-07-19\n", "2020-07-20\n", "2020-07-21\n", "2020-07-22\n", "2020-07-23\n", "2020-07-24\n", "2020-07-25\n", "2020-07-26\n", "2020-07-27\n", "2020-07-28\n", "2020-07-29\n", "2020-07-30\n", "2020-07-31\n", "2020-08-01\n", "2020-08-02\n", "2020-08-03\n", "2020-08-04\n", "2020-08-05\n", "2020-08-06\n", "2020-08-07\n", "2020-08-08\n", "2020-08-09\n", "2020-08-10\n", "2020-08-11\n", "2020-08-12\n", "2020-08-13\n", "2020-08-14\n", "2020-08-15\n", "2020-08-16\n", "2020-08-17\n", "2020-08-18\n", "2020-08-19\n", "2020-08-20\n", "2020-08-21\n", "2020-08-22\n", "2020-08-23\n", "2020-08-24\n", "2020-08-25\n", "2020-08-26\n", "2020-08-27\n", "2020-08-28\n", "2020-08-29\n", "2020-08-30\n", "2020-08-31\n", "2020-09-01\n", "2020-09-02\n", "2020-09-03\n", "2020-09-04\n", "2020-09-05\n", "2020-09-06\n", "2020-09-07\n", "2020-09-08\n", "2020-09-09\n", "2020-09-10\n", "2020-09-11\n", "2020-09-12\n", "2020-09-13\n", "2020-09-14\n", "2020-09-15\n", "2020-09-16\n", "2020-09-17\n", "2020-09-18\n", "2020-09-19\n", "2020-09-20\n", "2020-09-21\n", "2020-09-22\n", "2020-09-23\n", "2020-09-24\n", "2020-09-25\n", "2020-09-26\n", "2020-09-27\n", "2020-09-28\n", "2020-09-29\n", "2020-09-30\n", "2020-10-01\n", "2020-10-02\n", "2020-10-03\n", "2020-10-04\n", "2020-10-05\n", "2020-10-06\n", "2020-10-07\n", "2020-10-08\n", "2020-10-09\n", "2020-10-10\n", "2020-10-11\n", "2020-10-12\n", "2020-10-13\n", "2020-10-14\n", "2020-10-15\n", "2020-10-16\n", "2020-10-17\n", "2020-10-18\n", "2020-10-19\n", "2020-10-20\n", "2020-10-21\n", "2020-10-22\n", "2020-10-23\n", "2020-10-24\n", "2020-10-25\n", "2020-10-26\n", "2020-10-27\n", "2020-10-28\n", "2020-10-29\n", "2020-10-30\n", "2020-10-31\n", "2020-11-01\n", "2020-11-02\n", "2020-11-03\n", "2020-11-04\n", "2020-11-05\n", "2020-11-06\n", "2020-11-07\n", "2020-11-08\n", "2020-11-09\n", "2020-11-10\n", "2020-11-11\n", "2020-11-12\n", "2020-11-13\n", "2020-11-14\n", "2020-11-15\n", "2020-11-16\n", "2020-11-17\n", "2020-11-18\n", "2020-11-19\n", "2020-11-20\n", "2020-11-21\n", "2020-11-22\n", "2020-11-23\n", "2020-11-24\n", "2020-11-25\n", "2020-11-26\n", "2020-11-27\n", "2020-11-28\n", "2020-11-29\n", "2020-11-30\n", "2020-12-01\n", "2020-12-02\n", "2020-12-03\n", "2020-12-04\n", "2020-12-05\n", "2020-12-06\n", "2020-12-07\n", "2020-12-08\n", "2020-12-09\n", "2020-12-10\n", "2020-12-11\n", "2020-12-12\n", "2020-12-13\n", "2020-12-14\n", "2020-12-15\n", "2020-12-16\n", "2020-12-17\n", "2020-12-18\n", "2020-12-19\n", "2020-12-20\n", "2020-12-21\n", "2020-12-22\n", "2020-12-23\n", "2020-12-24\n", "2020-12-25\n", "2020-12-26\n", "2020-12-27\n", "2020-12-28\n", "2020-12-29\n", "2020-12-30\n", "2020-12-31\n", "2021-01-01\n", "2021-01-02\n", "2021-01-03\n", "2021-01-04\n", "2021-01-05\n", "2021-01-06\n", "2021-01-07\n", "2021-01-08\n", "2021-01-09\n", "2021-01-10\n", "2021-01-11\n", "2021-01-12\n", "2021-01-13\n", "2021-01-14\n", "2021-01-15\n", "2021-01-16\n", "2021-01-17\n", "2021-01-18\n", "2021-01-19\n", "2021-01-20\n", "2021-01-21\n", "2021-01-22\n", "2021-01-23\n", "2021-01-24\n", "2021-01-25\n", "2021-01-26\n", "2021-01-27\n", "2021-01-28\n", "2021-01-29\n", "2021-01-30\n", "2021-01-31\n", "2021-02-01\n", "2021-02-02\n", "2021-02-03\n", "2021-02-04\n", "2021-02-05\n", "2021-02-06\n", "2021-02-07\n", "2021-02-08\n", "2021-02-09\n", "2021-02-10\n", "2021-02-11\n", "2021-02-12\n", "2021-02-13\n", "2021-02-14\n", "2021-02-15\n", "2021-02-16\n", "2021-02-17\n", "2021-02-18\n", "2021-02-19\n", "2021-02-20\n", "2021-02-21\n", "2021-02-22\n", "2021-02-23\n", "2021-02-24\n", "2021-02-25\n", "2021-02-26\n", "2021-02-27\n", "2021-02-28\n", "2021-03-01\n", "2021-03-02\n", "2021-03-03\n", "2021-03-04\n", "2021-03-05\n", "2021-03-06\n", "2021-03-07\n", "2021-03-08\n", "2021-03-09\n", "2021-03-10\n", "2021-03-11\n", "2021-03-12\n", "2021-03-13\n", "2021-03-14\n", "2021-03-15\n", "2021-03-16\n", "2021-03-17\n", "2021-03-18\n", "2021-03-19\n", "2021-03-20\n", "2021-03-21\n", "2021-03-22\n", "2021-03-23\n", "2021-03-24\n", "2021-03-25\n", "2021-03-26\n", "2021-03-27\n", "2021-03-28\n", "2021-03-29\n", "2021-03-30\n", "2021-03-31\n", "2021-04-01\n", "2021-04-02\n", "2021-04-03\n", "2021-04-04\n", "2021-04-05\n", "2021-04-06\n", "2021-04-07\n", "2021-04-08\n", "2021-04-09\n", "2021-04-10\n", "2021-04-11\n", "2021-04-12\n", "2021-04-13\n", "2021-04-14\n", "2021-04-15\n", "2021-04-16\n", "2021-04-17\n", "2021-04-18\n", "2021-04-19\n", "2021-04-20\n", "2021-04-21\n", "2021-04-22\n", "2021-04-23\n", "2021-04-24\n", "2021-04-25\n", "2021-04-26\n", "2021-04-27\n", "2021-04-28\n", "2021-04-29\n", "2021-04-30\n", "2021-05-01\n", "2021-05-02\n", "2021-05-03\n", "2021-05-04\n", "2021-05-05\n", "2021-05-06\n", "2021-05-07\n", "2021-05-08\n", "2021-05-09\n", "2021-05-10\n", "2021-05-11\n", "2021-05-12\n", "2021-05-13\n", "2021-05-14\n", "2021-05-15\n", "2021-05-16\n", "2021-05-17\n", "2021-05-18\n", "2021-05-19\n", "2021-05-20\n", "2021-05-21\n", "2021-05-22\n", "2021-05-23\n", "2021-05-24\n", "2021-05-25\n", "2021-05-26\n", "2021-05-27\n", "2021-05-28\n", "2021-05-29\n", "2021-05-30\n", "2021-05-31\n", "2021-06-01\n", "2021-06-02\n", "2021-06-03\n", "2021-06-04\n", "2021-06-05\n", "2021-06-06\n", "2021-06-07\n", "2021-06-08\n", "2021-06-09\n", "2021-06-10\n", "2021-06-11\n", "2021-06-12\n", "2021-06-13\n", "2021-06-14\n", "2021-06-15\n", "2021-06-16\n", "2021-06-17\n", "2021-06-18\n", "2021-06-19\n", "2021-06-20\n", "2021-06-21\n", "2021-06-22\n", "2021-06-23\n", "2021-06-24\n", "2021-06-25\n", "2021-06-26\n", "2021-06-27\n", "2021-06-28\n", "2021-06-29\n", "2021-06-30\n", "2021-07-01\n", "2021-07-02\n", "2021-07-03\n", "2021-07-04\n", "2021-07-05\n", "2021-07-06\n", "2021-07-07\n", "2021-07-08\n", "2021-07-09\n", "2021-07-10\n", "2021-07-11\n", "2021-07-12\n", "2021-07-13\n", "2021-07-14\n", "2021-07-15\n", "2021-07-16\n", "2021-07-17\n", "2021-07-18\n", "2021-07-19\n", "2021-07-20\n", "2021-07-21\n", "2021-07-22\n", "2021-07-23\n", "2021-07-24\n", "2021-07-25\n", "2021-07-26\n", "2021-07-27\n", "2021-07-28\n", "2021-07-29\n", "2021-07-30\n", "2021-07-31\n", "2021-08-01\n", "2021-08-02\n", "2021-08-03\n", "2021-08-04\n", "2021-08-05\n", "2021-08-06\n", "2021-08-07\n", "2021-08-08\n", "2021-08-09\n", "2021-08-10\n", "2021-08-11\n", "2021-08-12\n", "2021-08-13\n", "2021-08-14\n", "2021-08-15\n", "2021-08-16\n", "2021-08-17\n", "2021-08-18\n", "2021-08-19\n", "2021-08-20\n", "2021-08-21\n", "2021-08-22\n", "2021-08-23\n", "2021-08-24\n", "2021-08-25\n", "2021-08-26\n", "2021-08-27\n", "2021-08-28\n", "2021-08-29\n", "2021-08-30\n", "2021-08-31\n", "2021-09-01\n", "2021-09-02\n", "2021-09-03\n", "2021-09-04\n", "2021-09-05\n", "2021-09-06\n", "2021-09-07\n", "2021-09-08\n", "2021-09-09\n", "2021-09-10\n", "2021-09-11\n", "2021-09-12\n", "2021-09-13\n", "2021-09-14\n", "2021-09-15\n", "2021-09-16\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2021-09-17\n", "2021-09-18\n", "2021-09-19\n", "2021-09-20\n", "2021-09-21\n", "2021-09-22\n", "2021-09-23\n", "2021-09-24\n", "2021-09-25\n", "2021-09-26\n", "2021-09-27\n", "2021-09-28\n", "2021-09-29\n", "2021-09-30\n", "2021-10-01\n", "2021-10-02\n", "2021-10-03\n", "2021-10-04\n", "2021-10-05\n", "2021-10-06\n", "2021-10-07\n", "2021-10-08\n", "2021-10-09\n", "2021-10-10\n", "2021-10-11\n", "2021-10-12\n", "2021-10-13\n", "2021-10-14\n", "2021-10-15\n", "2021-10-16\n", "2021-10-17\n", "2021-10-18\n", "2021-10-19\n", "2021-10-20\n", "2021-10-21\n", "2021-10-22\n", "2021-10-23\n", "2021-10-24\n", "2021-10-25\n", "2021-10-26\n", "2021-10-27\n", "2021-10-28\n", "2021-10-29\n", "2021-10-30\n", "2021-10-31\n", "2021-11-01\n", "2021-11-02\n", "2021-11-03\n", "2021-11-04\n", "2021-11-05\n", "2021-11-06\n", "2021-11-07\n", "2021-11-08\n", "2021-11-09\n", "2021-11-10\n", "2021-11-11\n", "2021-11-12\n", "2021-11-13\n", "2021-11-14\n", "2021-11-15\n", "2021-11-16\n", "2021-11-17\n", "2021-11-18\n", "2021-11-19\n", "2021-11-20\n", "2021-11-21\n", "2021-11-22\n", "2021-11-23\n", "2021-11-24\n", "2021-11-25\n", "2021-11-26\n", "2021-11-27\n", "2021-11-28\n", "2021-11-29\n", "2021-11-30\n", "2021-12-01\n", "2021-12-02\n", "2021-12-03\n", "2021-12-04\n", "2021-12-05\n", "2021-12-06\n", "2021-12-07\n", "2021-12-08\n", "2021-12-09\n", "2021-12-10\n", "2021-12-11\n", "2021-12-12\n", "2021-12-13\n", "2021-12-14\n", "2021-12-15\n", "2021-12-16\n", "2021-12-17\n", "2021-12-18\n", "2021-12-19\n", "2021-12-20\n", "2021-12-21\n", "2021-12-22\n", "2021-12-23\n", "2021-12-24\n", "2021-12-25\n", "2021-12-26\n", "2021-12-27\n", "2021-12-28\n", "2021-12-29\n", "2021-12-30\n", "2021-12-31\n", "2022-01-01\n", "2022-01-02\n", "2022-01-03\n", "2022-01-04\n", "2022-01-05\n", "2022-01-06\n", "2022-01-07\n", "2022-01-08\n", "2022-01-09\n", "2022-01-10\n", "2022-01-11\n", "2022-01-12\n", "2022-01-13\n", "2022-01-14\n", "2022-01-15\n", "2022-01-16\n", "2022-01-17\n", "2022-01-18\n", "2022-01-19\n", "2022-01-20\n", "2022-01-21\n", "2022-01-22\n", "2022-01-23\n", "2022-01-24\n", "2022-01-25\n", "2022-01-26\n", "2022-01-27\n", "2022-01-28\n", "2022-01-29\n", "2022-01-30\n", "2022-01-31\n", "2022-02-01\n", "2022-02-02\n", "2022-02-03\n", "2022-02-04\n", "2022-02-05\n", "2022-02-06\n", "2022-02-07\n", "2022-02-08\n", "2022-02-09\n", "2022-02-10\n", "2022-02-11\n", "2022-02-12\n", "2022-02-13\n", "2022-02-14\n", "2022-02-15\n", "2022-02-16\n", "2022-02-17\n", "2022-02-18\n", "2022-02-19\n", "2022-02-20\n", "2022-02-21\n", "2022-02-22\n", "2022-02-23\n", "2022-02-24\n", "2022-02-25\n", "2022-02-26\n", "2022-02-27\n", "2022-02-28\n", "2022-03-01\n", "2022-03-02\n", "2022-03-03\n", "2022-03-04\n", "2022-03-05\n", "2022-03-06\n", "2022-03-07\n", "2022-03-08\n", "2022-03-09\n", "2022-03-10\n", "2022-03-11\n", "2022-03-12\n", "2022-03-13\n", "2022-03-14\n", "2022-03-15\n", "2022-03-16\n", "2022-03-17\n", "2022-03-18\n", "2022-03-19\n", "2022-03-20\n", "2022-03-21\n", "2022-03-22\n", "2022-03-23\n", "2022-03-24\n", "2022-03-25\n", "2022-03-26\n", "2022-03-27\n", "2022-03-28\n", "2022-03-29\n", "2022-03-30\n", "2022-03-31\n", "2022-04-01\n", "2022-04-02\n", "2022-04-03\n", "2022-04-04\n", "2022-04-05\n", "2022-04-06\n", "2022-04-07\n", "2022-04-08\n", "2022-04-09\n", "2022-04-10\n", "2022-04-11\n", "2022-04-12\n", "2022-04-13\n", "2022-04-14\n", "2022-04-15\n", "2022-04-16\n", "2022-04-17\n", "2022-04-18\n", "2022-04-19\n", "2022-04-20\n", "2022-04-21\n", "2022-04-22\n", "2022-04-23\n", "2022-04-24\n", "2022-04-25\n", "2022-04-26\n", "2022-04-27\n", "2022-04-28\n", "2022-04-29\n", "2022-04-30\n", "2022-05-01\n", "2022-05-02\n", "2022-05-03\n", "2022-05-04\n", "2022-05-05\n", "2022-05-06\n", "2022-05-07\n", "2022-05-08\n", "2022-05-09\n", "2022-05-10\n", "2022-05-11\n", "2022-05-12\n", "2022-05-13\n", "2022-05-14\n", "2022-05-15\n", "2022-05-16\n", "2022-05-17\n", "2022-05-18\n", "2022-05-19\n", "2022-05-20\n", "2022-05-21\n", "2022-05-22\n", "2022-05-23\n", "2022-05-24\n", "2022-05-25\n", "2022-05-26\n", "2022-05-27\n", "2022-05-28\n", "2022-05-29\n", "2022-05-30\n", "2022-05-31\n", "2022-06-01\n", "2022-06-02\n", "2022-06-03\n", "2022-06-04\n", "2022-06-05\n", "2022-06-06\n", "2022-06-07\n", "2022-06-08\n", "2022-06-09\n", "2022-06-10\n", "2022-06-11\n", "2022-06-12\n", "2022-06-13\n", "2022-06-14\n", "2022-06-15\n", "2022-06-16\n", "2022-06-17\n", "2022-06-18\n", "2022-06-19\n", "2022-06-20\n", "2022-06-21\n", "2022-06-22\n", "2022-06-23\n", "2022-06-24\n", "2022-06-25\n", "2022-06-26\n", "2022-06-27\n", "2022-06-28\n", "2022-06-29\n", "2022-06-30\n", "2022-07-01\n", "2022-07-02\n", "2022-07-03\n", "2022-07-04\n", "2022-07-05\n", "2022-07-06\n", "2022-07-07\n", "2022-07-08\n", "2022-07-09\n", "2022-07-10\n", "2022-07-11\n", "2022-07-12\n", "2022-07-13\n", "2022-07-14\n", "2022-07-15\n", "2022-07-16\n", "2022-07-17\n", "2022-07-18\n", "2022-07-19\n", "2022-07-20\n", "2022-07-21\n", "2022-07-22\n", "2022-07-23\n", "2022-07-24\n", "2022-07-25\n", "2022-07-26\n", "2022-07-27\n", "2022-07-28\n", "2022-07-29\n", "2022-07-30\n", "2022-07-31\n", "2022-08-01\n", "2022-08-02\n", "2022-08-03\n", "2022-08-04\n", "2022-08-05\n", "2022-08-06\n", "2022-08-07\n", "2022-08-08\n", "2022-08-09\n", "2022-08-10\n", "2022-08-11\n", "2022-08-12\n", "2022-08-13\n", "2022-08-14\n", "2022-08-15\n", "2022-08-16\n", "2022-08-17\n", "2022-08-18\n", "2022-08-19\n", "2022-08-20\n", "2022-08-21\n", "2022-08-22\n", "2022-08-23\n", "2022-08-24\n", "2022-08-25\n", "2022-08-26\n", "2022-08-27\n", "2022-08-28\n", "2022-08-29\n", "2022-08-30\n", "2022-08-31\n", "2022-09-01\n", "2022-09-02\n", "2022-09-03\n", "2022-09-04\n", "2022-09-05\n", "2022-09-06\n", "2022-09-07\n", "2022-09-08\n", "2022-09-09\n", "2022-09-10\n", "2022-09-11\n", "2022-09-12\n", "2022-09-13\n", "2022-09-14\n", "2022-09-15\n", "2022-09-16\n", "2022-09-17\n", "2022-09-18\n", "2022-09-19\n", "2022-09-20\n", "2022-09-21\n", "2022-09-22\n", "2022-09-23\n", "2022-09-24\n", "2022-09-25\n", "2022-09-26\n", "2022-09-27\n", "2022-09-28\n", "2022-09-29\n", "2022-09-30\n", "2022-10-01\n", "2022-10-02\n", "2022-10-03\n", "2022-10-04\n", "2022-10-05\n", "2022-10-06\n", "2022-10-07\n", "2022-10-08\n", "2022-10-09\n", "2022-10-10\n", "2022-10-11\n", "2022-10-12\n", "2022-10-13\n", "2022-10-14\n", "2022-10-15\n", "2022-10-16\n", "2022-10-17\n", "2022-10-18\n", "2022-10-19\n", "2022-10-20\n", "2022-10-21\n", "2022-10-22\n", "2022-10-23\n", "2022-10-24\n", "2022-10-25\n", "2022-10-26\n", "2022-10-27\n", "2022-10-28\n", "2022-10-29\n", "2022-10-30\n", "2022-10-31\n", "2022-11-01\n", "2022-11-02\n", "2022-11-03\n", "2022-11-04\n", "2022-11-05\n", "2022-11-06\n", "2022-11-07\n", "2022-11-08\n", "2022-11-09\n", "2022-11-10\n", "2022-11-11\n", "2022-11-12\n", "2022-11-13\n", "2022-11-14\n", "2022-11-15\n", "2022-11-16\n", "2022-11-17\n", "2022-11-18\n", "2022-11-19\n", "2022-11-20\n", "2022-11-21\n", "2022-11-22\n", "2022-11-23\n", "2022-11-24\n", "2022-11-25\n", "2022-11-26\n", "2022-11-27\n", "2022-11-28\n", "2022-11-29\n", "2022-11-30\n", "2022-12-01\n", "2022-12-02\n", "2022-12-03\n", "2022-12-04\n", "2022-12-05\n", "2022-12-06\n", "2022-12-07\n", "2022-12-08\n", "2022-12-09\n", "2022-12-10\n", "2022-12-11\n", "2022-12-12\n", "2022-12-13\n", "2022-12-14\n", "2022-12-15\n", "2022-12-16\n", "2022-12-17\n", "2022-12-18\n", "2022-12-19\n", "2022-12-20\n", "2022-12-21\n", "2022-12-22\n", "2022-12-23\n", "2022-12-24\n", "2022-12-25\n", "2022-12-26\n", "2022-12-27\n", "2022-12-28\n", "2022-12-29\n", "2022-12-30\n", "2022-12-31\n", "2023-01-01\n", "2023-01-02\n", "2023-01-03\n", "2023-01-04\n", "2023-01-05\n", "2023-01-06\n", "2023-01-07\n", "2023-01-08\n", "2023-01-09\n", "2023-01-10\n", "2023-01-11\n", "2023-01-12\n", "2023-01-13\n", "2023-01-14\n", "2023-01-15\n", "2023-01-16\n", "2023-01-17\n", "2023-01-18\n", "2023-01-19\n", "2023-01-20\n", "2023-01-21\n", "2023-01-22\n", "2023-01-23\n", "2023-01-24\n", "2023-01-25\n", "2023-01-26\n", "2023-01-27\n", "2023-01-28\n", "2023-01-29\n", "2023-01-30\n", "2023-01-31\n", "2023-02-01\n", "2023-02-02\n", "2023-02-03\n", "2023-02-04\n", "2023-02-05\n", "2023-02-06\n", "2023-02-07\n", "2023-02-08\n", "2023-02-09\n", "2023-02-10\n", "2023-02-11\n", "2023-02-12\n", "2023-02-13\n", "2023-02-14\n", "2023-02-15\n", "2023-02-16\n", "2023-02-17\n", "2023-02-18\n", "2023-02-19\n", "2023-02-20\n", "2023-02-21\n", "2023-02-22\n", "2023-02-23\n", "2023-02-24\n", "2023-02-25\n", "2023-02-26\n", "2023-02-27\n", "2023-02-28\n", "2023-03-01\n", "2023-03-02\n", "2023-03-03\n", "2023-03-04\n", "2023-03-05\n", "2023-03-06\n", "2023-03-07\n", "2023-03-08\n", "2023-03-09\n", "2023-03-10\n", "2023-03-11\n", "2023-03-12\n", "2023-03-13\n", "2023-03-14\n", "2023-03-15\n", "2023-03-16\n", "2023-03-17\n", "2023-03-18\n", "2023-03-19\n", "2023-03-20\n", "2023-03-21\n", "2023-03-22\n", "2023-03-23\n", "2023-03-24\n", "2023-03-25\n", "2023-03-26\n", "2023-03-27\n", "2023-03-28\n", "2023-03-29\n", "2023-03-30\n", "2023-03-31\n", "2023-04-01\n", "2023-04-02\n", "2023-04-03\n", "2023-04-04\n", "2023-04-05\n", "2023-04-06\n", "2023-04-07\n", "2023-04-08\n", "2023-04-09\n", "2023-04-10\n", "2023-04-11\n", "2023-04-12\n", "2023-04-13\n", "2023-04-14\n", "2023-04-15\n", "2023-04-16\n", "2023-04-17\n", "2023-04-18\n", "2023-04-19\n", "2023-04-20\n", "2023-04-21\n", "2023-04-22\n", "2023-04-23\n", "2023-04-24\n", "2023-04-25\n", "2023-04-26\n", "2023-04-27\n", "2023-04-28\n", "2023-04-29\n", "2023-04-30\n", "2023-05-01\n", "2023-05-02\n", "2023-05-03\n", "2023-05-04\n", "2023-05-05\n", "2023-05-06\n", "2023-05-07\n", "2023-05-08\n", "2023-05-09\n", "2023-05-10\n", "2023-05-11\n", "2023-05-12\n", "2023-05-13\n", "2023-05-14\n", "2023-05-15\n", "2023-05-16\n", "2023-05-17\n", "2023-05-18\n", "2023-05-19\n", "2023-05-20\n", "2023-05-21\n", "2023-05-22\n", "2023-05-23\n", "2023-05-24\n", "2023-05-25\n", "2023-05-26\n", "2023-05-27\n", "2023-05-28\n", "2023-05-29\n", "2023-05-30\n", "2023-05-31\n", "2023-06-01\n", "2023-06-02\n", "2023-06-03\n", "2023-06-04\n", "2023-06-05\n", "2023-06-06\n", "2023-06-07\n", "2023-06-08\n", "2023-06-09\n", "2023-06-10\n", "2023-06-11\n", "2023-06-12\n", "2023-06-13\n", "2023-06-14\n", "2023-06-15\n", "2023-06-16\n", "2023-06-17\n", "2023-06-18\n", "2023-06-19\n", "2023-06-20\n", "2023-06-21\n", "2023-06-22\n", "2023-06-23\n", "2023-06-24\n", "2023-06-25\n", "2023-06-26\n", "2023-06-27\n", "2023-06-28\n", "2023-06-29\n", "2023-06-30\n", "2023-07-01\n", "2023-07-02\n", "2023-07-03\n", "2023-07-04\n", "2023-07-05\n", "2023-07-06\n", "2023-07-07\n", "2023-07-08\n", "2023-07-09\n", "2023-07-10\n", "2023-07-11\n", "2023-07-12\n", "2023-07-13\n", "2023-07-14\n", "2023-07-15\n", "2023-07-16\n", "2023-07-17\n", "2023-07-18\n", "2023-07-19\n", "2023-07-20\n", "2023-07-21\n", "2023-07-22\n", "2023-07-23\n", "2023-07-24\n", "2023-07-25\n", "2023-07-26\n", "2023-07-27\n", "2023-07-28\n", "2023-07-29\n", "2023-07-30\n", "2023-07-31\n", "2023-08-01\n", "2023-08-02\n", "2023-08-03\n", "2023-08-04\n", "2023-08-05\n", "2023-08-06\n", "2023-08-07\n", "2023-08-08\n", "2023-08-09\n", "2023-08-10\n", "2023-08-11\n", "2023-08-12\n", "2023-08-13\n", "2023-08-14\n", "2023-08-15\n", "2023-08-16\n", "2023-08-17\n", "2023-08-18\n", "2023-08-19\n", "2023-08-20\n", "2023-08-21\n", "2023-08-22\n", "2023-08-23\n", "2023-08-24\n", "2023-08-25\n", "2023-08-26\n", "2023-08-27\n", "2023-08-28\n", "2023-08-29\n", "2023-08-30\n", "2023-08-31\n", "2023-09-01\n", "2023-09-02\n", "2023-09-03\n", "2023-09-04\n", "2023-09-05\n", "2023-09-06\n", "2023-09-07\n", "2023-09-08\n", "2023-09-09\n", "2023-09-10\n", "2023-09-11\n", "2023-09-12\n", "2023-09-13\n", "2023-09-14\n", "2023-09-15\n", "2023-09-16\n", "2023-09-17\n", "2023-09-18\n", "2023-09-19\n", "2023-09-20\n", "2023-09-21\n", "2023-09-22\n", "2023-09-23\n", "2023-09-24\n", "2023-09-25\n", "2023-09-26\n", "2023-09-27\n", "2023-09-28\n", "2023-09-29\n", "2023-09-30\n", "2023-10-01\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2023-10-02\n", "2023-10-03\n", "2023-10-04\n", "2023-10-05\n", "2023-10-06\n", "2023-10-07\n", "2023-10-08\n", "2023-10-09\n", "2023-10-10\n", "2023-10-11\n", "2023-10-12\n", "2023-10-13\n", "2023-10-14\n", "2023-10-15\n", "2023-10-16\n", "2023-10-17\n", "2023-10-18\n", "2023-10-19\n", "2023-10-20\n", "2023-10-21\n", "2023-10-22\n", "2023-10-23\n", "2023-10-24\n", "2023-10-25\n", "2023-10-26\n", "2023-10-27\n", "2023-10-28\n", "2023-10-29\n", "2023-10-30\n", "2023-10-31\n", "2023-11-01\n", "2023-11-02\n", "2023-11-03\n", "2023-11-04\n", "2023-11-05\n", "2023-11-06\n", "2023-11-07\n", "2023-11-08\n", "2023-11-09\n", "2023-11-10\n", "2023-11-11\n", "2023-11-12\n", "2023-11-13\n", "2023-11-14\n", "2023-11-15\n", "2023-11-16\n", "2023-11-17\n", "2023-11-18\n", "2023-11-19\n", "2023-11-20\n", "2023-11-21\n", "2023-11-22\n", "2023-11-23\n", "2023-11-24\n", "2023-11-25\n", "2023-11-26\n", "2023-11-27\n", "2023-11-28\n", "2023-11-29\n", "2023-11-30\n", "2023-12-01\n", "2023-12-02\n", "2023-12-03\n", "2023-12-04\n", "2023-12-05\n", "2023-12-06\n", "2023-12-07\n", "2023-12-08\n", "2023-12-09\n", "2023-12-10\n", "2023-12-11\n", "2023-12-12\n", "2023-12-13\n", "2023-12-14\n", "2023-12-15\n", "2023-12-16\n", "2023-12-17\n", "2023-12-18\n", "2023-12-19\n", "2023-12-20\n", "2023-12-21\n", "2023-12-22\n", "2023-12-23\n", "2023-12-24\n", "2023-12-25\n", "2023-12-26\n", "2023-12-27\n", "2023-12-28\n", "2023-12-29\n", "2023-12-30\n", "2023-12-31\n", "2024-01-01\n", "2024-01-02\n", "2024-01-03\n", "2024-01-04\n", "2024-01-05\n", "2024-01-06\n", "2024-01-07\n", "2024-01-08\n", "2024-01-09\n", "2024-01-10\n", "2024-01-11\n", "2024-01-12\n", "2024-01-13\n", "2024-01-14\n", "2024-01-15\n", "2024-01-16\n", "2024-01-17\n", "2024-01-18\n", "2024-01-19\n", "2024-01-20\n", "2024-01-21\n", "2024-01-22\n", "2024-01-23\n", "2024-01-24\n", "2024-01-25\n", "2024-01-26\n", "2024-01-27\n", "2024-01-28\n", "2024-01-29\n", "2024-01-30\n", "2024-01-31\n", "2024-02-01\n", "2024-02-02\n", "2024-02-03\n", "2024-02-04\n", "2024-02-05\n", "2024-02-06\n", "2024-02-07\n", "2024-02-08\n", "2024-02-09\n", "2024-02-10\n", "2024-02-11\n", "2024-02-12\n", "2024-02-13\n", "2024-02-14\n", "2024-02-15\n", "2024-02-16\n", "2024-02-17\n", "2024-02-18\n", "2024-02-19\n", "2024-02-20\n", "2024-02-21\n", "2024-02-22\n", "2024-02-23\n", "2024-02-24\n", "2024-02-25\n", "2024-02-26\n", "2024-02-27\n", "2024-02-28\n", "2024-02-29\n", "2024-03-01\n", "2024-03-02\n", "2024-03-03\n", "2024-03-04\n", "2024-03-05\n", "2024-03-06\n", "2024-03-07\n", "2024-03-08\n", "2024-03-09\n", "2024-03-10\n", "2024-03-11\n", "2024-03-12\n", "2024-03-13\n", "2024-03-14\n", "2024-03-15\n", "2024-03-16\n", "2024-03-17\n", "2024-03-18\n", "2024-03-19\n", "2024-03-20\n", "2024-03-21\n", "2024-03-22\n", "2024-03-23\n", "2024-03-24\n", "2024-03-25\n", "2024-03-26\n", "2024-03-27\n", "2024-03-28\n", "2024-03-29\n", "2024-03-30\n", "2024-03-31\n", "2024-04-01\n", "2024-04-02\n", "2024-04-03\n", "2024-04-04\n", "2024-04-05\n", "2024-04-06\n", "2024-04-07\n", "2024-04-08\n", "2024-04-09\n", "2024-04-10\n", "2024-04-11\n", "2024-04-12\n", "2024-04-13\n", "2024-04-14\n", "2024-04-15\n", "2024-04-16\n", "2024-04-17\n", "2024-04-18\n", "2024-04-19\n", "2024-04-20\n", "2024-04-21\n", "2024-04-22\n", "2024-04-23\n", "2024-04-24\n", "2024-04-25\n", "2024-04-26\n", "2024-04-27\n", "2024-04-28\n", "2024-04-29\n", "2024-04-30\n", "2024-05-01\n", "2024-05-02\n", "2024-05-03\n", "2024-05-04\n", "2024-05-05\n", "2024-05-06\n", "2024-05-07\n", "2024-05-08\n", "2024-05-09\n", "2024-05-10\n", "2024-05-11\n", "2024-05-12\n", "2024-05-13\n", "2024-05-14\n", "2024-05-15\n", "2024-05-16\n", "2024-05-17\n", "2024-05-18\n", "2024-05-19\n", "2024-05-20\n", "2024-05-21\n", "2024-05-22\n", "2024-05-23\n", "2024-05-24\n", "2024-05-25\n", "2024-05-26\n", "2024-05-27\n", "2024-05-28\n", "2024-05-29\n", "2024-05-30\n", "2024-05-31\n", "2024-06-01\n", "2024-06-02\n", "2024-06-03\n", "2024-06-04\n", "2024-06-05\n", "2024-06-06\n", "2024-06-07\n", "2024-06-08\n", "2024-06-09\n", "2024-06-10\n", "2024-06-11\n", "2024-06-12\n", "2024-06-13\n", "2024-06-14\n", "2024-06-15\n", "2024-06-16\n", "2024-06-17\n", "2024-06-18\n", "2024-06-19\n", "2024-06-20\n", "2024-06-21\n", "2024-06-22\n", "2024-06-23\n", "2024-06-24\n", "2024-06-25\n", "2024-06-26\n", "2024-06-27\n", "2024-06-28\n", "2024-06-29\n", "2024-06-30\n", "program done\n" ] } ], "source": [ "import csv\n", "import datetime\n", "import collections\n", "import math\n", "\n", "headings = ['date', 'NDA', 'UPA', 'Others']\n", "\n", "with open(\"alliances_over_time_realistic.csv\", \"wb\") as filex: #after this change mode to ab for append\n", " wr = csv.writer(filex, delimiter = ',' , quotechar = '\"' )\n", " wr.writerow(headings)\n", " #seems you have to use the write mode as 'wb' instead of 'w', it's some Windows quirk - https://stackoverflow.com/a/3191811\n", "\n", "#creating a range of dates from Aug 19, 2017 to July 1, 2024\n", "#Aug 19 is when all the new Rajya Sabha MPs from Gujarat and West Bengal take their seats\n", "\n", "#got the code below from https://stackoverflow.com/a/24637447\n", "\n", "start = datetime.datetime.strptime(\"19-08-2017\", \"%d-%m-%Y\")\n", "end = datetime.datetime.strptime(\"01-07-2024\", \"%d-%m-%Y\")\n", "date_generated = [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)]\n", "\n", "for this_date_raw in date_generated:\n", " this_date = this_date_raw.date()\n", " #print type(this_date)\n", " print this_date\n", " NDA = 0\n", " UPA = 0\n", " \n", " #Initialise variables NDA = 0, UPA = 0\n", "\n", " #for each row in the rs_data csv, ie. for each of the 245 seats in the Rajya Sabha\n", " \n", " for index, row in df_rs_data.iterrows():\n", "\n", " #rs_seat_retirement_date_raw = row['retirement_date']\n", " #rs_seat_retirement_date = datetime.datetime.strptime(rs_seat_retirement_date_raw, \"%d-%m-%Y\")\n", " rs_seat_retirement_date = row['retirement_date']\n", " \n", " \n", " #the line above is is about making python recognise the object as a date and not as a text string\n", " \n", " #the stackoverflow link below clarifies why it's datetime.datetime and not just datetime: \n", " #https://stackoverflow.com/a/12070240\n", " \n", " alliance = row['alliance']\n", " \n", " state = row['state']\n", " \n", " rs_mp_name = row['name'] #note this could be marked 'VACANT' too, have contingency plans for that\n", " \n", " #assembly_end_date_raw = str(df_assembly_dates[df_assembly_dates['state'] == state]['term_ends']).strip('\\n')\n", " \n", " if state != 'Nominated':\n", " #assembly_end_date_raw = df_assembly_dates[df_assembly_dates['state'] == state]['term_ends'].values[0]\n", " #assembly_end_date = datetime.datetime.strptime(assembly_end_date_raw, \"%d-%m-%Y\")\n", " #code above from https://stackoverflow.com/a/36684095\n", " assembly_end_date = df_assembly_dates[df_assembly_dates['state'] == state]['term_ends'].values[0]\n", " \n", " if this_date <= rs_seat_retirement_date: \n", " if rs_mp_name != 'VACANT':\n", "\n", " if alliance == 'NDA':\n", " NDA += 1\n", " elif alliance == 'UPA':\n", " UPA += 1\n", "\n", " else: # ie. if seat is marked 'vacant'\n", "\n", " if this_date <= assembly_end_date:\n", "\n", " diff_bw_this_date_retirement_date = rs_seat_retirement_date - this_date\n", "\n", " if diff_bw_this_date_retirement_date.days > 365:\n", "\n", " #want to calculate what the earliest retirement date is for any seat in the Rajya Sabha\n", "\n", " #am assuming that the election commission will hold the by-poll for \n", " #a vacant RS seat when there are elections for other RS seats going on\n", " #they won't be grouped together though\n", " #the elections could be held sooner too, but it won't be held later than that\n", " #this is all about calculating the most recent date by which these vacancies are guaranteed \n", " #to be filled\n", "\n", " next_any_state_retirement_date = df_rs_data[(df_rs_data['retirement_date'] >= this_date) &\\\n", " (df_rs_data['retirement_date'] < rs_seat_retirement_date)].min()[\"retirement_date\"]\n", "\n", " date_difference_any_state = rs_seat_retirement_date - next_any_state_retirement_date\n", "\n", " #am assuming that if there's less than a year for the term for the seat to end, the Election \n", " #commission would rather leave the seat vacant till the term is up and not bother with holding \n", " #two elections for the same seat within a year\n", " #but that if there's more than a year left, the commission might organise the election\n", "\n", " if date_difference_any_state.days > 365:\n", "\n", " if this_date > next_any_state_retirement_date:\n", "\n", " seats_vacant_now_state2 = len(df_rs_data[(df_rs_data['state'] == state) &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date) &\\\n", " (rs_mp_name == 'VACANT')])\n", "\n", " assembly_seats_total_v2 = df_assembly_data[df_assembly_data['state'] == state].sum()[\"seats\"]\n", "\n", " droop_quota_v2 = math.floor((assembly_seats_total_v2 * 100)/(seats_vacant_now_state2 + 1)) + 1\n", "\n", " #now i've seen the droop quota calculated in some places as \n", " #math.floor((assembly_seats_total_v2)/(seats_vacant_now_state2 + 1)) + 1\n", " #that's certainly how most of the media have been doing it in the runup to \n", " #the Gujarat Rajya Sabha polls\n", " #I will do it the way the election commission has done it in their \n", " #handbook for election officials, the link is http://bit.ly/2vy4cyX\n", "\n", " nda_strength_v2 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", " #code above from https://stackoverflow.com/a/20995313\n", "\n", " upa_strength_v2 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " #below I'm calculating the number of seats any party will get in an RS election for a \n", " #specific number of vacancies\n", "\n", " nda_seats_v2 = math.floor((nda_strength_v2 * 100)/droop_quota_v2)\n", "\n", " upa_seats_v2 = math.floor((upa_strength_v2 * 100)/droop_quota_v2)\n", "\n", " #I'll be rounding down the result, so am using math.floor function here, \n", " \n", "\n", " NDA += nda_seats_v2/seats_vacant_now_state2\n", "\n", " UPA += upa_seats_v2/seats_vacant_now_state2\n", " \n", " else: # ie. this_date > rs_seat_retirement_date\n", "\n", " if this_date <= assembly_end_date:\n", "\n", " if state not in ['Delhi', 'Punjab']:\n", "\n", " #no else statement if this_date > assembly_end_date, it becomes part of OTHERS grouping\n", " #we're just calculating min. guaranteed UPA and NDA seats here\n", "\n", " #find number of seats from the state which share the same retirement date\n", "\n", " vacancies_number_v3 = len(df_rs_data[(df_rs_data['state'] == state) &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date)])\n", " #code above from https://stackoverflow.com/a/17322585 \n", "\n", " #calculate droop quota , crudely put, it's the no. of seats a party or alliance should\n", " #have in a state legislature to guarantee a minimum of one Rajya Sabha seat from the RS vacancies\n", " #being contested\n", "\n", " assembly_seats_total_v3 = df_assembly_data[df_assembly_data['state'] == state].sum()[\"seats\"]\n", "\n", " droop_quota_v3 = math.floor((assembly_seats_total_v3 * 100)/(vacancies_number_v3 + 1)) + 1\n", "\n", " nda_strength_v3 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", " #code above from https://stackoverflow.com/a/20995313\n", "\n", " upa_strength_v3 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " #below I'm calculating the number of seats any party will get in an RS election for a \n", " #specific number of vacancies\n", "\n", " nda_seats_v3 = math.floor((nda_strength_v3 * 100)/droop_quota_v3)\n", "\n", " upa_seats_v3 = math.floor((upa_strength_v3 * 100)/droop_quota_v3)\n", "\n", " #I'll be rounding down the result, so am using math.floor function here, \n", " \n", "\n", " NDA += nda_seats_v3/vacancies_number_v3\n", "\n", " UPA += upa_seats_v3/vacancies_number_v3\n", "\n", " #realised later that I'm double or triple counting the no. of seats an alliance would get\n", " #basically by dividing it by the number of vacancies, I'm ensuring that when everything is summed up later\n", " #you get back the actual no. of minimum guaranteed nda_seats and upa_seats\n", "\n", " elif state == 'Delhi':\n", "\n", " vacancies_number_d = 1 \n", "\n", " #so delhi has 3 RS seats, all with terms ending on the same day\n", " #but the vacancies will not be counted together\n", " #there will be separate elections for each of the three seats\n", " #below is the link to the Election commission notification explaining why:\n", " #http://eci.nic.in/eci_main1/current/PN19122011.pdf \n", " #and an official press release about it: http://pib.nic.in/newsite/PrintRelease.aspx?relid=79013\n", "\n", " assembly_seats_total_d = df_assembly_data[df_assembly_data['state'] == 'Delhi'].sum()[\"seats\"]\n", "\n", " droop_quota_d = math.floor((assembly_seats_total_d * 100)/(vacancies_number_d + 1)) + 1\n", "\n", " nda_strength_d = df_assembly_data[(df_assembly_data['state'] == 'Delhi') &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", " #code above from https://stackoverflow.com/a/20995313\n", "\n", " upa_strength_d = df_assembly_data[(df_assembly_data['state'] == 'Delhi') &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " #below I'm calculating the number of seats any party will get in an RS election for a \n", " #specific number of vacancies\n", "\n", " nda_seats_d = math.floor((nda_strength_d * 100)/droop_quota_d)\n", "\n", " upa_seats_d = math.floor((upa_strength_d * 100)/droop_quota_d)\n", "\n", " #I'll be rounding down the result, so am using math.floor function here, \n", " \n", "\n", " NDA += nda_seats_d #Do I need to divide by vacancies_number_d here? No\n", "\n", " UPA += upa_seats_d \n", "\n", " elif state == 'Punjab':\n", "\n", " punjab_dates_list = df_rs_data[df_rs_data['state'] == 'Punjab']['retirement_date'].tolist()\n", "\n", " #the line above gives us a list of retirement dates for RS MPs from Punjab\n", "\n", " punjab_dates_freq = dict(collections.Counter(punjab_dates_list))\n", "\n", " #the line above gives us a frequency table of those dates\n", "\n", " #got the code above from https://stackoverflow.com/a/23240989\n", "\n", " #so there are five seats (out of 7) with the same retirement date and another group of 2\n", "\n", " #from that first group of five, there are two separate elections, one for 3 seats and one for 2 seats\n", " \n", " #why that is the case, I don't know, it just is! Here is the link to the Election commission notification:\n", " #http://eci.nic.in/eci_main1/current/PN15_24022016.pdf\n", "\n", "\n", " #from the frequency table, we can identify those 5 seats with the same retirement date\n", "\n", "\n", " if punjab_dates_freq[rs_seat_retirement_date] == 5: #if the retirement date is the one for the five seats\n", "\n", " vacancies_number_p_g2 = 2 #g2 for group of two\n", "\n", " vacancies_number_p_g3 = 3 #g3 for group of three\n", "\n", " assembly_seats_total_p = df_assembly_data[df_assembly_data['state'] == 'Punjab'].sum()[\"seats\"] \n", "\n", " droop_quota_p_g2 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p_g2 + 1)) + 1\n", "\n", " droop_quota_p_g3 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p_g3 + 1)) + 1\n", "\n", " nda_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", " #code above from https://stackoverflow.com/a/20995313\n", "\n", " upa_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " nda_seats_p_g2 = math.floor((nda_strength_p * 100)/droop_quota_p_g2)\n", "\n", " upa_seats_p_g2 = math.floor((upa_strength_p * 100)/droop_quota_p_g2)\n", "\n", " nda_seats_p_g3 = math.floor((nda_strength_p * 100)/droop_quota_p_g3)\n", "\n", " upa_seats_p_g3 = math.floor((upa_strength_p * 100)/droop_quota_p_g3)\n", "\n", " #I'll be rounding down the result, so am using math.floor function here, \n", " \n", "\n", " NDA += (nda_seats_p_g2 + nda_seats_p_g3)/5 #Is dividing by 5 the right thing here?\n", " #guess so, since the number of seats NDA & UPA seats\n", " #will be counted five times\n", "\n", " UPA += (upa_seats_p_g2 + upa_seats_p_g3)/5 \n", "\n", "\n", " else: #if it's the group of two RS seats from Punjab that share the same retirement date\n", "\n", " vacancies_number_p2 = len(df_rs_data[(df_rs_data['state'] == 'Punjab') &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date)])\n", "\n", " assembly_seats_total_p2 = df_assembly_data[df_assembly_data['state'] == 'Punjab'].sum()[\"seats\"]\n", "\n", " droop_quota_p2 = math.floor((assembly_seats_total_p2 * 100)/(vacancies_number_p2 + 1)) + 1\n", "\n", " nda_strength_p2 = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", " #code above from https://stackoverflow.com/a/20995313\n", "\n", " upa_strength_p2 = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " #below I'm calculating the number of seats any party will get in an RS election for a \n", " #specific number of vacancies\n", "\n", " nda_seats_p2 = math.floor((nda_strength_p2 * 100)/droop_quota_p2)\n", "\n", " upa_seats_p2 = math.floor((upa_strength_p2 * 100)/droop_quota_p2)\n", "\n", " #I'll be rounding down the result, so am using math.floor function here, \n", " \n", "\n", " NDA += nda_seats_p2/vacancies_number_p2\n", "\n", " UPA += upa_seats_p2/vacancies_number_p2 \n", " \n", " else: #if it is a nominated seat, the 'state' is marked 'nominated' in the data\n", " if this_date <= rs_seat_retirement_date:\n", " if alliance == 'NDA':\n", " NDA += 1\n", " elif alliance == 'UPA':\n", " UPA += 1\n", " #and if there is no alliance affiliation recorded against that MP, do nothing\n", " #and if the date is after the retirement date, we can't say anything anyway\n", " #note that here I know there are no vacancies among nominated seats, so I didn't provide an if/else for that\n", "\n", " OTHERS = 245 - (NDA + UPA)\n", " \n", " csv_row = list()\n", " csv_row.append(this_date)\n", " csv_row.append(NDA)\n", " csv_row.append(UPA)\n", " csv_row.append(OTHERS)\n", " \n", " with open(\"alliances_over_time_realistic.csv\", \"ab\") as filez:\n", " wrz = csv.writer(filez, delimiter = ',' , quotechar = '\"' )\n", " wrz.writerow(csv_row)\n", "\n", "filez.close()\n", "\n", "print \"program done\"" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2017-08-19\n", "2017-08-20\n", "2017-08-21\n", "2017-08-22\n", "2017-08-23\n", "2017-08-24\n", "2017-08-25\n", "2017-08-26\n", "2017-08-27\n", "2017-08-28\n", "2017-08-29\n", "2017-08-30\n", "2017-08-31\n", "2017-09-01\n", "2017-09-02\n", "2017-09-03\n", "2017-09-04\n", "2017-09-05\n", "2017-09-06\n", "2017-09-07\n", "2017-09-08\n", "2017-09-09\n", "2017-09-10\n", "2017-09-11\n", "2017-09-12\n", "2017-09-13\n", "2017-09-14\n", "2017-09-15\n", "2017-09-16\n", "2017-09-17\n", "2017-09-18\n", "2017-09-19\n", "2017-09-20\n", "2017-09-21\n", "2017-09-22\n", "2017-09-23\n", "2017-09-24\n", "2017-09-25\n", "2017-09-26\n", "2017-09-27\n", "2017-09-28\n", "2017-09-29\n", "2017-09-30\n", "2017-10-01\n", "2017-10-02\n", "2017-10-03\n", "2017-10-04\n", "2017-10-05\n", "2017-10-06\n", "2017-10-07\n", "2017-10-08\n", "2017-10-09\n", "2017-10-10\n", "2017-10-11\n", "2017-10-12\n", "2017-10-13\n", "2017-10-14\n", "2017-10-15\n", "2017-10-16\n", "2017-10-17\n", "2017-10-18\n", "2017-10-19\n", "2017-10-20\n", "2017-10-21\n", "2017-10-22\n", "2017-10-23\n", "2017-10-24\n", "2017-10-25\n", "2017-10-26\n", "2017-10-27\n", "2017-10-28\n", "2017-10-29\n", "2017-10-30\n", "2017-10-31\n", "2017-11-01\n", "2017-11-02\n", "2017-11-03\n", "2017-11-04\n", "2017-11-05\n", "2017-11-06\n", "2017-11-07\n", "2017-11-08\n", "2017-11-09\n", "2017-11-10\n", "2017-11-11\n", "2017-11-12\n", "2017-11-13\n", "2017-11-14\n", "2017-11-15\n", "2017-11-16\n", "2017-11-17\n", "2017-11-18\n", "2017-11-19\n", "2017-11-20\n", "2017-11-21\n", "2017-11-22\n", "2017-11-23\n", "2017-11-24\n", "2017-11-25\n", "2017-11-26\n", "2017-11-27\n", "2017-11-28\n", "2017-11-29\n", "2017-11-30\n", "2017-12-01\n", "2017-12-02\n", "2017-12-03\n", "2017-12-04\n", "2017-12-05\n", "2017-12-06\n", "2017-12-07\n", "2017-12-08\n", "2017-12-09\n", "2017-12-10\n", "2017-12-11\n", "2017-12-12\n", "2017-12-13\n", "2017-12-14\n", "2017-12-15\n", "2017-12-16\n", "2017-12-17\n", "2017-12-18\n", "2017-12-19\n", "2017-12-20\n", "2017-12-21\n", "2017-12-22\n", "2017-12-23\n", "2017-12-24\n", "2017-12-25\n", "2017-12-26\n", "2017-12-27\n", "2017-12-28\n", "2017-12-29\n", "2017-12-30\n", "2017-12-31\n", "2018-01-01\n", "2018-01-02\n", "2018-01-03\n", "2018-01-04\n", "2018-01-05\n", "2018-01-06\n", "2018-01-07\n", "2018-01-08\n", "2018-01-09\n", "2018-01-10\n", "2018-01-11\n", "2018-01-12\n", "2018-01-13\n", "2018-01-14\n", "2018-01-15\n", "2018-01-16\n", "2018-01-17\n", "2018-01-18\n", "2018-01-19\n", "2018-01-20\n", "2018-01-21\n", "2018-01-22\n", "2018-01-23\n", "2018-01-24\n", "2018-01-25\n", "2018-01-26\n", "2018-01-27\n", "2018-01-28\n", "2018-01-29\n", "2018-01-30\n", "2018-01-31\n", "2018-02-01\n", "2018-02-02\n", "2018-02-03\n", "2018-02-04\n", "2018-02-05\n", "2018-02-06\n", "2018-02-07\n", "2018-02-08\n", "2018-02-09\n", "2018-02-10\n", "2018-02-11\n", "2018-02-12\n", "2018-02-13\n", "2018-02-14\n", "2018-02-15\n", "2018-02-16\n", "2018-02-17\n", "2018-02-18\n", "2018-02-19\n", "2018-02-20\n", "2018-02-21\n", "2018-02-22\n", "2018-02-23\n", "2018-02-24\n", "2018-02-25\n", "2018-02-26\n", "2018-02-27\n", "2018-02-28\n", "2018-03-01\n", "2018-03-02\n", "2018-03-03\n", "2018-03-04\n", "2018-03-05\n", "2018-03-06\n", "2018-03-07\n", "2018-03-08\n", "2018-03-09\n", "2018-03-10\n", "2018-03-11\n", "2018-03-12\n", "2018-03-13\n", "2018-03-14\n", "2018-03-15\n", "2018-03-16\n", "2018-03-17\n", "2018-03-18\n", "2018-03-19\n", "2018-03-20\n", "2018-03-21\n", "2018-03-22\n", "2018-03-23\n", "2018-03-24\n", "2018-03-25\n", "2018-03-26\n", "2018-03-27\n", "2018-03-28\n", "2018-03-29\n", "2018-03-30\n", "2018-03-31\n", "2018-04-01\n", "2018-04-02\n", "2018-04-03\n", "2018-04-04\n", "2018-04-05\n", "2018-04-06\n", "2018-04-07\n", "2018-04-08\n", "2018-04-09\n", "2018-04-10\n", "2018-04-11\n", "2018-04-12\n", "2018-04-13\n", "2018-04-14\n", "2018-04-15\n", "2018-04-16\n", "2018-04-17\n", "2018-04-18\n", "2018-04-19\n", "2018-04-20\n", "2018-04-21\n", "2018-04-22\n", "2018-04-23\n", "2018-04-24\n", "2018-04-25\n", "2018-04-26\n", "2018-04-27\n", "2018-04-28\n", "2018-04-29\n", "2018-04-30\n", "2018-05-01\n", "2018-05-02\n", "2018-05-03\n", "2018-05-04\n", "2018-05-05\n", "2018-05-06\n", "2018-05-07\n", "2018-05-08\n", "2018-05-09\n", "2018-05-10\n", "2018-05-11\n", "2018-05-12\n", "2018-05-13\n", "2018-05-14\n", "2018-05-15\n", "2018-05-16\n", "2018-05-17\n", "2018-05-18\n", "2018-05-19\n", "2018-05-20\n", "2018-05-21\n", "2018-05-22\n", "2018-05-23\n", "2018-05-24\n", "2018-05-25\n", "2018-05-26\n", "2018-05-27\n", "2018-05-28\n", "2018-05-29\n", "2018-05-30\n", "2018-05-31\n", "2018-06-01\n", "2018-06-02\n", "2018-06-03\n", "2018-06-04\n", "2018-06-05\n", "2018-06-06\n", "2018-06-07\n", "2018-06-08\n", "2018-06-09\n", "2018-06-10\n", "2018-06-11\n", "2018-06-12\n", "2018-06-13\n", "2018-06-14\n", "2018-06-15\n", "2018-06-16\n", "2018-06-17\n", "2018-06-18\n", "2018-06-19\n", "2018-06-20\n", "2018-06-21\n", "2018-06-22\n", "2018-06-23\n", "2018-06-24\n", "2018-06-25\n", "2018-06-26\n", "2018-06-27\n", "2018-06-28\n", "2018-06-29\n", "2018-06-30\n", "2018-07-01\n", "2018-07-02\n", "2018-07-03\n", "2018-07-04\n", "2018-07-05\n", "2018-07-06\n", "2018-07-07\n", "2018-07-08\n", "2018-07-09\n", "2018-07-10\n", "2018-07-11\n", "2018-07-12\n", "2018-07-13\n", "2018-07-14\n", "2018-07-15\n", "2018-07-16\n", "2018-07-17\n", "2018-07-18\n", "2018-07-19\n", "2018-07-20\n", "2018-07-21\n", "2018-07-22\n", "2018-07-23\n", "2018-07-24\n", "2018-07-25\n", "2018-07-26\n", "2018-07-27\n", "2018-07-28\n", "2018-07-29\n", "2018-07-30\n", "2018-07-31\n", "2018-08-01\n", "2018-08-02\n", "2018-08-03\n", "2018-08-04\n", "2018-08-05\n", "2018-08-06\n", "2018-08-07\n", "2018-08-08\n", "2018-08-09\n", "2018-08-10\n", "2018-08-11\n", "2018-08-12\n", "2018-08-13\n", "2018-08-14\n", "2018-08-15\n", "2018-08-16\n", "2018-08-17\n", "2018-08-18\n", "2018-08-19\n", "2018-08-20\n", "2018-08-21\n", "2018-08-22\n", "2018-08-23\n", "2018-08-24\n", "2018-08-25\n", "2018-08-26\n", "2018-08-27\n", "2018-08-28\n", "2018-08-29\n", "2018-08-30\n", "2018-08-31\n", "2018-09-01\n", "2018-09-02\n", "2018-09-03\n", "2018-09-04\n", "2018-09-05\n", "2018-09-06\n", "2018-09-07\n", "2018-09-08\n", "2018-09-09\n", "2018-09-10\n", "2018-09-11\n", "2018-09-12\n", "2018-09-13\n", "2018-09-14\n", "2018-09-15\n", "2018-09-16\n", "2018-09-17\n", "2018-09-18\n", "2018-09-19\n", "2018-09-20\n", "2018-09-21\n", "2018-09-22\n", "2018-09-23\n", "2018-09-24\n", "2018-09-25\n", "2018-09-26\n", "2018-09-27\n", "2018-09-28\n", "2018-09-29\n", "2018-09-30\n", "2018-10-01\n", "2018-10-02\n", "2018-10-03\n", "2018-10-04\n", "2018-10-05\n", "2018-10-06\n", "2018-10-07\n", "2018-10-08\n", "2018-10-09\n", "2018-10-10\n", "2018-10-11\n", "2018-10-12\n", "2018-10-13\n", "2018-10-14\n", "2018-10-15\n", "2018-10-16\n", "2018-10-17\n", "2018-10-18\n", "2018-10-19\n", "2018-10-20\n", "2018-10-21\n", "2018-10-22\n", "2018-10-23\n", "2018-10-24\n", "2018-10-25\n", "2018-10-26\n", "2018-10-27\n", "2018-10-28\n", "2018-10-29\n", "2018-10-30\n", "2018-10-31\n", "2018-11-01\n", "2018-11-02\n", "2018-11-03\n", "2018-11-04\n", "2018-11-05\n", "2018-11-06\n", "2018-11-07\n", "2018-11-08\n", "2018-11-09\n", "2018-11-10\n", "2018-11-11\n", "2018-11-12\n", "2018-11-13\n", "2018-11-14\n", "2018-11-15\n", "2018-11-16\n", "2018-11-17\n", "2018-11-18\n", "2018-11-19\n", "2018-11-20\n", "2018-11-21\n", "2018-11-22\n", "2018-11-23\n", "2018-11-24\n", "2018-11-25\n", "2018-11-26\n", "2018-11-27\n", "2018-11-28\n", "2018-11-29\n", "2018-11-30\n", "2018-12-01\n", "2018-12-02\n", "2018-12-03\n", "2018-12-04\n", "2018-12-05\n", "2018-12-06\n", "2018-12-07\n", "2018-12-08\n", "2018-12-09\n", "2018-12-10\n", "2018-12-11\n", "2018-12-12\n", "2018-12-13\n", "2018-12-14\n", "2018-12-15\n", "2018-12-16\n", "2018-12-17\n", "2018-12-18\n", "2018-12-19\n", "2018-12-20\n", "2018-12-21\n", "2018-12-22\n", "2018-12-23\n", "2018-12-24\n", "2018-12-25\n", "2018-12-26\n", "2018-12-27\n", "2018-12-28\n", "2018-12-29\n", "2018-12-30\n", "2018-12-31\n", "2019-01-01\n", "2019-01-02\n", "2019-01-03\n", "2019-01-04\n", "2019-01-05\n", "2019-01-06\n", "2019-01-07\n", "2019-01-08\n", "2019-01-09\n", "2019-01-10\n", "2019-01-11\n", "2019-01-12\n", "2019-01-13\n", "2019-01-14\n", "2019-01-15\n", "2019-01-16\n", "2019-01-17\n", "2019-01-18\n", "2019-01-19\n", "2019-01-20\n", "2019-01-21\n", "2019-01-22\n", "2019-01-23\n", "2019-01-24\n", "2019-01-25\n", "2019-01-26\n", "2019-01-27\n", "2019-01-28\n", "2019-01-29\n", "2019-01-30\n", "2019-01-31\n", "2019-02-01\n", "2019-02-02\n", "2019-02-03\n", "2019-02-04\n", "2019-02-05\n", "2019-02-06\n", "2019-02-07\n", "2019-02-08\n", "2019-02-09\n", "2019-02-10\n", "2019-02-11\n", "2019-02-12\n", "2019-02-13\n", "2019-02-14\n", "2019-02-15\n", "2019-02-16\n", "2019-02-17\n", "2019-02-18\n", "2019-02-19\n", "2019-02-20\n", "2019-02-21\n", "2019-02-22\n", "2019-02-23\n", "2019-02-24\n", "2019-02-25\n", "2019-02-26\n", "2019-02-27\n", "2019-02-28\n", "2019-03-01\n", "2019-03-02\n", "2019-03-03\n", "2019-03-04\n", "2019-03-05\n", "2019-03-06\n", "2019-03-07\n", "2019-03-08\n", "2019-03-09\n", "2019-03-10\n", "2019-03-11\n", "2019-03-12\n", "2019-03-13\n", "2019-03-14\n", "2019-03-15\n", "2019-03-16\n", "2019-03-17\n", "2019-03-18\n", "2019-03-19\n", "2019-03-20\n", "2019-03-21\n", "2019-03-22\n", "2019-03-23\n", "2019-03-24\n", "2019-03-25\n", "2019-03-26\n", "2019-03-27\n", "2019-03-28\n", "2019-03-29\n", "2019-03-30\n", "2019-03-31\n", "2019-04-01\n", "2019-04-02\n", "2019-04-03\n", "2019-04-04\n", "2019-04-05\n", "2019-04-06\n", "2019-04-07\n", "2019-04-08\n", "2019-04-09\n", "2019-04-10\n", "2019-04-11\n", "2019-04-12\n", "2019-04-13\n", "2019-04-14\n", "2019-04-15\n", "2019-04-16\n", "2019-04-17\n", "2019-04-18\n", "2019-04-19\n", "2019-04-20\n", "2019-04-21\n", "2019-04-22\n", "2019-04-23\n", "2019-04-24\n", "2019-04-25\n", "2019-04-26\n", "2019-04-27\n", "2019-04-28\n", "2019-04-29\n", "2019-04-30\n", "2019-05-01\n", "2019-05-02\n", "2019-05-03\n", "2019-05-04\n", "2019-05-05\n", "2019-05-06\n", "2019-05-07\n", "2019-05-08\n", "2019-05-09\n", "2019-05-10\n", "2019-05-11\n", "2019-05-12\n", "2019-05-13\n", "2019-05-14\n", "2019-05-15\n", "2019-05-16\n", "2019-05-17\n", "2019-05-18\n", "2019-05-19\n", "2019-05-20\n", "2019-05-21\n", "2019-05-22\n", "2019-05-23\n", "2019-05-24\n", "2019-05-25\n", "2019-05-26\n", "2019-05-27\n", "2019-05-28\n", "2019-05-29\n", "2019-05-30\n", "2019-05-31\n", "2019-06-01\n", "2019-06-02\n", "2019-06-03\n", "2019-06-04\n", "2019-06-05\n", "2019-06-06\n", "2019-06-07\n", "2019-06-08\n", "2019-06-09\n", "2019-06-10\n", "2019-06-11\n", "2019-06-12\n", "2019-06-13\n", "2019-06-14\n", "2019-06-15\n", "2019-06-16\n", "2019-06-17\n", "2019-06-18\n", "2019-06-19\n", "2019-06-20\n", "2019-06-21\n", "2019-06-22\n", "2019-06-23\n", "2019-06-24\n", "2019-06-25\n", "2019-06-26\n", "2019-06-27\n", "2019-06-28\n", "2019-06-29\n", "2019-06-30\n", "2019-07-01\n", "2019-07-02\n", "2019-07-03\n", "2019-07-04\n", "2019-07-05\n", "2019-07-06\n", "2019-07-07\n", "2019-07-08\n", "2019-07-09\n", "2019-07-10\n", "2019-07-11\n", "2019-07-12\n", "2019-07-13\n", "2019-07-14\n", "2019-07-15\n", "2019-07-16\n", "2019-07-17\n", "2019-07-18\n", "2019-07-19\n", "2019-07-20\n", "2019-07-21\n", "2019-07-22\n", "2019-07-23\n", "2019-07-24\n", "2019-07-25\n", "2019-07-26\n", "2019-07-27\n", "2019-07-28\n", "2019-07-29\n", "2019-07-30\n", "2019-07-31\n", "2019-08-01\n", "2019-08-02\n", "2019-08-03\n", "2019-08-04\n", "2019-08-05\n", "2019-08-06\n", "2019-08-07\n", "2019-08-08\n", "2019-08-09\n", "2019-08-10\n", "2019-08-11\n", "2019-08-12\n", "2019-08-13\n", "2019-08-14\n", "2019-08-15\n", "2019-08-16\n", "2019-08-17\n", "2019-08-18\n", "2019-08-19\n", "2019-08-20\n", "2019-08-21\n", "2019-08-22\n", "2019-08-23\n", "2019-08-24\n", "2019-08-25\n", "2019-08-26\n", "2019-08-27\n", "2019-08-28\n", "2019-08-29\n", "2019-08-30\n", "2019-08-31\n", "2019-09-01\n", "2019-09-02\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2019-09-03\n", "2019-09-04\n", "2019-09-05\n", "2019-09-06\n", "2019-09-07\n", "2019-09-08\n", "2019-09-09\n", "2019-09-10\n", "2019-09-11\n", "2019-09-12\n", "2019-09-13\n", "2019-09-14\n", "2019-09-15\n", "2019-09-16\n", "2019-09-17\n", "2019-09-18\n", "2019-09-19\n", "2019-09-20\n", "2019-09-21\n", "2019-09-22\n", "2019-09-23\n", "2019-09-24\n", "2019-09-25\n", "2019-09-26\n", "2019-09-27\n", "2019-09-28\n", "2019-09-29\n", "2019-09-30\n", "2019-10-01\n", "2019-10-02\n", "2019-10-03\n", "2019-10-04\n", "2019-10-05\n", "2019-10-06\n", "2019-10-07\n", "2019-10-08\n", "2019-10-09\n", "2019-10-10\n", "2019-10-11\n", "2019-10-12\n", "2019-10-13\n", "2019-10-14\n", "2019-10-15\n", "2019-10-16\n", "2019-10-17\n", "2019-10-18\n", "2019-10-19\n", "2019-10-20\n", "2019-10-21\n", "2019-10-22\n", "2019-10-23\n", "2019-10-24\n", "2019-10-25\n", "2019-10-26\n", "2019-10-27\n", "2019-10-28\n", "2019-10-29\n", "2019-10-30\n", "2019-10-31\n", "2019-11-01\n", "2019-11-02\n", "2019-11-03\n", "2019-11-04\n", "2019-11-05\n", "2019-11-06\n", "2019-11-07\n", "2019-11-08\n", "2019-11-09\n", "2019-11-10\n", "2019-11-11\n", "2019-11-12\n", "2019-11-13\n", "2019-11-14\n", "2019-11-15\n", "2019-11-16\n", "2019-11-17\n", "2019-11-18\n", "2019-11-19\n", "2019-11-20\n", "2019-11-21\n", "2019-11-22\n", "2019-11-23\n", "2019-11-24\n", "2019-11-25\n", "2019-11-26\n", "2019-11-27\n", "2019-11-28\n", "2019-11-29\n", "2019-11-30\n", "2019-12-01\n", "2019-12-02\n", "2019-12-03\n", "2019-12-04\n", "2019-12-05\n", "2019-12-06\n", "2019-12-07\n", "2019-12-08\n", "2019-12-09\n", "2019-12-10\n", "2019-12-11\n", "2019-12-12\n", "2019-12-13\n", "2019-12-14\n", "2019-12-15\n", "2019-12-16\n", "2019-12-17\n", "2019-12-18\n", "2019-12-19\n", "2019-12-20\n", "2019-12-21\n", "2019-12-22\n", "2019-12-23\n", "2019-12-24\n", "2019-12-25\n", "2019-12-26\n", "2019-12-27\n", "2019-12-28\n", "2019-12-29\n", "2019-12-30\n", "2019-12-31\n", "2020-01-01\n", "2020-01-02\n", "2020-01-03\n", "2020-01-04\n", "2020-01-05\n", "2020-01-06\n", "2020-01-07\n", "2020-01-08\n", "2020-01-09\n", "2020-01-10\n", "2020-01-11\n", "2020-01-12\n", "2020-01-13\n", "2020-01-14\n", "2020-01-15\n", "2020-01-16\n", "2020-01-17\n", "2020-01-18\n", "2020-01-19\n", "2020-01-20\n", "2020-01-21\n", "2020-01-22\n", "2020-01-23\n", "2020-01-24\n", "2020-01-25\n", "2020-01-26\n", "2020-01-27\n", "2020-01-28\n", "2020-01-29\n", "2020-01-30\n", "2020-01-31\n", "2020-02-01\n", "2020-02-02\n", "2020-02-03\n", "2020-02-04\n", "2020-02-05\n", "2020-02-06\n", "2020-02-07\n", "2020-02-08\n", "2020-02-09\n", "2020-02-10\n", "2020-02-11\n", "2020-02-12\n", "2020-02-13\n", "2020-02-14\n", "2020-02-15\n", "2020-02-16\n", "2020-02-17\n", "2020-02-18\n", "2020-02-19\n", "2020-02-20\n", "2020-02-21\n", "2020-02-22\n", "2020-02-23\n", "2020-02-24\n", "2020-02-25\n", "2020-02-26\n", "2020-02-27\n", "2020-02-28\n", "2020-02-29\n", "2020-03-01\n", "2020-03-02\n", "2020-03-03\n", "2020-03-04\n", "2020-03-05\n", "2020-03-06\n", "2020-03-07\n", "2020-03-08\n", "2020-03-09\n", "2020-03-10\n", "2020-03-11\n", "2020-03-12\n", "2020-03-13\n", "2020-03-14\n", "2020-03-15\n", "2020-03-16\n", "2020-03-17\n", "2020-03-18\n", "2020-03-19\n", "2020-03-20\n", "2020-03-21\n", "2020-03-22\n", "2020-03-23\n", "2020-03-24\n", "2020-03-25\n", "2020-03-26\n", "2020-03-27\n", "2020-03-28\n", "2020-03-29\n", "2020-03-30\n", "2020-03-31\n", "2020-04-01\n", "2020-04-02\n", "2020-04-03\n", "2020-04-04\n", "2020-04-05\n", "2020-04-06\n", "2020-04-07\n", "2020-04-08\n", "2020-04-09\n", "2020-04-10\n", "2020-04-11\n", "2020-04-12\n", "2020-04-13\n", "2020-04-14\n", "2020-04-15\n", "2020-04-16\n", "2020-04-17\n", "2020-04-18\n", "2020-04-19\n", "2020-04-20\n", "2020-04-21\n", "2020-04-22\n", "2020-04-23\n", "2020-04-24\n", "2020-04-25\n", "2020-04-26\n", "2020-04-27\n", "2020-04-28\n", "2020-04-29\n", "2020-04-30\n", "2020-05-01\n", "2020-05-02\n", "2020-05-03\n", "2020-05-04\n", "2020-05-05\n", "2020-05-06\n", "2020-05-07\n", "2020-05-08\n", "2020-05-09\n", "2020-05-10\n", "2020-05-11\n", "2020-05-12\n", "2020-05-13\n", "2020-05-14\n", "2020-05-15\n", "2020-05-16\n", "2020-05-17\n", "2020-05-18\n", "2020-05-19\n", "2020-05-20\n", "2020-05-21\n", "2020-05-22\n", "2020-05-23\n", "2020-05-24\n", "2020-05-25\n", "2020-05-26\n", "2020-05-27\n", "2020-05-28\n", "2020-05-29\n", "2020-05-30\n", "2020-05-31\n", "2020-06-01\n", "2020-06-02\n", "2020-06-03\n", "2020-06-04\n", "2020-06-05\n", "2020-06-06\n", "2020-06-07\n", "2020-06-08\n", "2020-06-09\n", "2020-06-10\n", "2020-06-11\n", "2020-06-12\n", "2020-06-13\n", "2020-06-14\n", "2020-06-15\n", "2020-06-16\n", "2020-06-17\n", "2020-06-18\n", "2020-06-19\n", "2020-06-20\n", "2020-06-21\n", "2020-06-22\n", "2020-06-23\n", "2020-06-24\n", "2020-06-25\n", "2020-06-26\n", "2020-06-27\n", "2020-06-28\n", "2020-06-29\n", "2020-06-30\n", "2020-07-01\n", "2020-07-02\n", "2020-07-03\n", "2020-07-04\n", "2020-07-05\n", "2020-07-06\n", "2020-07-07\n", "2020-07-08\n", "2020-07-09\n", "2020-07-10\n", "2020-07-11\n", "2020-07-12\n", "2020-07-13\n", "2020-07-14\n", "2020-07-15\n", "2020-07-16\n", "2020-07-17\n", "2020-07-18\n", "2020-07-19\n", "2020-07-20\n", "2020-07-21\n", "2020-07-22\n", "2020-07-23\n", "2020-07-24\n", "2020-07-25\n", "2020-07-26\n", "2020-07-27\n", "2020-07-28\n", "2020-07-29\n", "2020-07-30\n", "2020-07-31\n", "2020-08-01\n", "2020-08-02\n", "2020-08-03\n", "2020-08-04\n", "2020-08-05\n", "2020-08-06\n", "2020-08-07\n", "2020-08-08\n", "2020-08-09\n", "2020-08-10\n", "2020-08-11\n", "2020-08-12\n", "2020-08-13\n", "2020-08-14\n", "2020-08-15\n", "2020-08-16\n", "2020-08-17\n", "2020-08-18\n", "2020-08-19\n", "2020-08-20\n", "2020-08-21\n", "2020-08-22\n", "2020-08-23\n", "2020-08-24\n", "2020-08-25\n", "2020-08-26\n", "2020-08-27\n", "2020-08-28\n", "2020-08-29\n", "2020-08-30\n", "2020-08-31\n", "2020-09-01\n", "2020-09-02\n", "2020-09-03\n", "2020-09-04\n", "2020-09-05\n", "2020-09-06\n", "2020-09-07\n", "2020-09-08\n", "2020-09-09\n", "2020-09-10\n", "2020-09-11\n", "2020-09-12\n", "2020-09-13\n", "2020-09-14\n", "2020-09-15\n", "2020-09-16\n", "2020-09-17\n", "2020-09-18\n", "2020-09-19\n", "2020-09-20\n", "2020-09-21\n", "2020-09-22\n", "2020-09-23\n", "2020-09-24\n", "2020-09-25\n", "2020-09-26\n", "2020-09-27\n", "2020-09-28\n", "2020-09-29\n", "2020-09-30\n", "2020-10-01\n", "2020-10-02\n", "2020-10-03\n", "2020-10-04\n", "2020-10-05\n", "2020-10-06\n", "2020-10-07\n", "2020-10-08\n", "2020-10-09\n", "2020-10-10\n", "2020-10-11\n", "2020-10-12\n", "2020-10-13\n", "2020-10-14\n", "2020-10-15\n", "2020-10-16\n", "2020-10-17\n", "2020-10-18\n", "2020-10-19\n", "2020-10-20\n", "2020-10-21\n", "2020-10-22\n", "2020-10-23\n", "2020-10-24\n", "2020-10-25\n", "2020-10-26\n", "2020-10-27\n", "2020-10-28\n", "2020-10-29\n", "2020-10-30\n", "2020-10-31\n", "2020-11-01\n", "2020-11-02\n", "2020-11-03\n", "2020-11-04\n", "2020-11-05\n", "2020-11-06\n", "2020-11-07\n", "2020-11-08\n", "2020-11-09\n", "2020-11-10\n", "2020-11-11\n", "2020-11-12\n", "2020-11-13\n", "2020-11-14\n", "2020-11-15\n", "2020-11-16\n", "2020-11-17\n", "2020-11-18\n", "2020-11-19\n", "2020-11-20\n", "2020-11-21\n", "2020-11-22\n", "2020-11-23\n", "2020-11-24\n", "2020-11-25\n", "2020-11-26\n", "2020-11-27\n", "2020-11-28\n", "2020-11-29\n", "2020-11-30\n", "2020-12-01\n", "2020-12-02\n", "2020-12-03\n", "2020-12-04\n", "2020-12-05\n", "2020-12-06\n", "2020-12-07\n", "2020-12-08\n", "2020-12-09\n", "2020-12-10\n", "2020-12-11\n", "2020-12-12\n", "2020-12-13\n", "2020-12-14\n", "2020-12-15\n", "2020-12-16\n", "2020-12-17\n", "2020-12-18\n", "2020-12-19\n", "2020-12-20\n", "2020-12-21\n", "2020-12-22\n", "2020-12-23\n", "2020-12-24\n", "2020-12-25\n", "2020-12-26\n", "2020-12-27\n", "2020-12-28\n", "2020-12-29\n", "2020-12-30\n", "2020-12-31\n", "2021-01-01\n", "2021-01-02\n", "2021-01-03\n", "2021-01-04\n", "2021-01-05\n", "2021-01-06\n", "2021-01-07\n", "2021-01-08\n", "2021-01-09\n", "2021-01-10\n", "2021-01-11\n", "2021-01-12\n", "2021-01-13\n", "2021-01-14\n", "2021-01-15\n", "2021-01-16\n", "2021-01-17\n", "2021-01-18\n", "2021-01-19\n", "2021-01-20\n", "2021-01-21\n", "2021-01-22\n", "2021-01-23\n", "2021-01-24\n", "2021-01-25\n", "2021-01-26\n", "2021-01-27\n", "2021-01-28\n", "2021-01-29\n", "2021-01-30\n", "2021-01-31\n", "2021-02-01\n", "2021-02-02\n", "2021-02-03\n", "2021-02-04\n", "2021-02-05\n", "2021-02-06\n", "2021-02-07\n", "2021-02-08\n", "2021-02-09\n", "2021-02-10\n", "2021-02-11\n", "2021-02-12\n", "2021-02-13\n", "2021-02-14\n", "2021-02-15\n", "2021-02-16\n", "2021-02-17\n", "2021-02-18\n", "2021-02-19\n", "2021-02-20\n", "2021-02-21\n", "2021-02-22\n", "2021-02-23\n", "2021-02-24\n", "2021-02-25\n", "2021-02-26\n", "2021-02-27\n", "2021-02-28\n", "2021-03-01\n", "2021-03-02\n", "2021-03-03\n", "2021-03-04\n", "2021-03-05\n", "2021-03-06\n", "2021-03-07\n", "2021-03-08\n", "2021-03-09\n", "2021-03-10\n", "2021-03-11\n", "2021-03-12\n", "2021-03-13\n", "2021-03-14\n", "2021-03-15\n", "2021-03-16\n", "2021-03-17\n", "2021-03-18\n", "2021-03-19\n", "2021-03-20\n", "2021-03-21\n", "2021-03-22\n", "2021-03-23\n", "2021-03-24\n", "2021-03-25\n", "2021-03-26\n", "2021-03-27\n", "2021-03-28\n", "2021-03-29\n", "2021-03-30\n", "2021-03-31\n", "2021-04-01\n", "2021-04-02\n", "2021-04-03\n", "2021-04-04\n", "2021-04-05\n", "2021-04-06\n", "2021-04-07\n", "2021-04-08\n", "2021-04-09\n", "2021-04-10\n", "2021-04-11\n", "2021-04-12\n", "2021-04-13\n", "2021-04-14\n", "2021-04-15\n", "2021-04-16\n", "2021-04-17\n", "2021-04-18\n", "2021-04-19\n", "2021-04-20\n", "2021-04-21\n", "2021-04-22\n", "2021-04-23\n", "2021-04-24\n", "2021-04-25\n", "2021-04-26\n", "2021-04-27\n", "2021-04-28\n", "2021-04-29\n", "2021-04-30\n", "2021-05-01\n", "2021-05-02\n", "2021-05-03\n", "2021-05-04\n", "2021-05-05\n", "2021-05-06\n", "2021-05-07\n", "2021-05-08\n", "2021-05-09\n", "2021-05-10\n", "2021-05-11\n", "2021-05-12\n", "2021-05-13\n", "2021-05-14\n", "2021-05-15\n", "2021-05-16\n", "2021-05-17\n", "2021-05-18\n", "2021-05-19\n", "2021-05-20\n", "2021-05-21\n", "2021-05-22\n", "2021-05-23\n", "2021-05-24\n", "2021-05-25\n", "2021-05-26\n", "2021-05-27\n", "2021-05-28\n", "2021-05-29\n", "2021-05-30\n", "2021-05-31\n", "2021-06-01\n", "2021-06-02\n", "2021-06-03\n", "2021-06-04\n", "2021-06-05\n", "2021-06-06\n", "2021-06-07\n", "2021-06-08\n", "2021-06-09\n", "2021-06-10\n", "2021-06-11\n", "2021-06-12\n", "2021-06-13\n", "2021-06-14\n", "2021-06-15\n", "2021-06-16\n", "2021-06-17\n", "2021-06-18\n", "2021-06-19\n", "2021-06-20\n", "2021-06-21\n", "2021-06-22\n", "2021-06-23\n", "2021-06-24\n", "2021-06-25\n", "2021-06-26\n", "2021-06-27\n", "2021-06-28\n", "2021-06-29\n", "2021-06-30\n", "2021-07-01\n", "2021-07-02\n", "2021-07-03\n", "2021-07-04\n", "2021-07-05\n", "2021-07-06\n", "2021-07-07\n", "2021-07-08\n", "2021-07-09\n", "2021-07-10\n", "2021-07-11\n", "2021-07-12\n", "2021-07-13\n", "2021-07-14\n", "2021-07-15\n", "2021-07-16\n", "2021-07-17\n", "2021-07-18\n", "2021-07-19\n", "2021-07-20\n", "2021-07-21\n", "2021-07-22\n", "2021-07-23\n", "2021-07-24\n", "2021-07-25\n", "2021-07-26\n", "2021-07-27\n", "2021-07-28\n", "2021-07-29\n", "2021-07-30\n", "2021-07-31\n", "2021-08-01\n", "2021-08-02\n", "2021-08-03\n", "2021-08-04\n", "2021-08-05\n", "2021-08-06\n", "2021-08-07\n", "2021-08-08\n", "2021-08-09\n", "2021-08-10\n", "2021-08-11\n", "2021-08-12\n", "2021-08-13\n", "2021-08-14\n", "2021-08-15\n", "2021-08-16\n", "2021-08-17\n", "2021-08-18\n", "2021-08-19\n", "2021-08-20\n", "2021-08-21\n", "2021-08-22\n", "2021-08-23\n", "2021-08-24\n", "2021-08-25\n", "2021-08-26\n", "2021-08-27\n", "2021-08-28\n", "2021-08-29\n", "2021-08-30\n", "2021-08-31\n", "2021-09-01\n", "2021-09-02\n", "2021-09-03\n", "2021-09-04\n", "2021-09-05\n", "2021-09-06\n", "2021-09-07\n", "2021-09-08\n", "2021-09-09\n", "2021-09-10\n", "2021-09-11\n", "2021-09-12\n", "2021-09-13\n", "2021-09-14\n", "2021-09-15\n", "2021-09-16\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2021-09-17\n", "2021-09-18\n", "2021-09-19\n", "2021-09-20\n", "2021-09-21\n", "2021-09-22\n", "2021-09-23\n", "2021-09-24\n", "2021-09-25\n", "2021-09-26\n", "2021-09-27\n", "2021-09-28\n", "2021-09-29\n", "2021-09-30\n", "2021-10-01\n", "2021-10-02\n", "2021-10-03\n", "2021-10-04\n", "2021-10-05\n", "2021-10-06\n", "2021-10-07\n", "2021-10-08\n", "2021-10-09\n", "2021-10-10\n", "2021-10-11\n", "2021-10-12\n", "2021-10-13\n", "2021-10-14\n", "2021-10-15\n", "2021-10-16\n", "2021-10-17\n", "2021-10-18\n", "2021-10-19\n", "2021-10-20\n", "2021-10-21\n", "2021-10-22\n", "2021-10-23\n", "2021-10-24\n", "2021-10-25\n", "2021-10-26\n", "2021-10-27\n", "2021-10-28\n", "2021-10-29\n", "2021-10-30\n", "2021-10-31\n", "2021-11-01\n", "2021-11-02\n", "2021-11-03\n", "2021-11-04\n", "2021-11-05\n", "2021-11-06\n", "2021-11-07\n", "2021-11-08\n", "2021-11-09\n", "2021-11-10\n", "2021-11-11\n", "2021-11-12\n", "2021-11-13\n", "2021-11-14\n", "2021-11-15\n", "2021-11-16\n", "2021-11-17\n", "2021-11-18\n", "2021-11-19\n", "2021-11-20\n", "2021-11-21\n", "2021-11-22\n", "2021-11-23\n", "2021-11-24\n", "2021-11-25\n", "2021-11-26\n", "2021-11-27\n", "2021-11-28\n", "2021-11-29\n", "2021-11-30\n", "2021-12-01\n", "2021-12-02\n", "2021-12-03\n", "2021-12-04\n", "2021-12-05\n", "2021-12-06\n", "2021-12-07\n", "2021-12-08\n", "2021-12-09\n", "2021-12-10\n", "2021-12-11\n", "2021-12-12\n", "2021-12-13\n", "2021-12-14\n", "2021-12-15\n", "2021-12-16\n", "2021-12-17\n", "2021-12-18\n", "2021-12-19\n", "2021-12-20\n", "2021-12-21\n", "2021-12-22\n", "2021-12-23\n", "2021-12-24\n", "2021-12-25\n", "2021-12-26\n", "2021-12-27\n", "2021-12-28\n", "2021-12-29\n", "2021-12-30\n", "2021-12-31\n", "2022-01-01\n", "2022-01-02\n", "2022-01-03\n", "2022-01-04\n", "2022-01-05\n", "2022-01-06\n", "2022-01-07\n", "2022-01-08\n", "2022-01-09\n", "2022-01-10\n", "2022-01-11\n", "2022-01-12\n", "2022-01-13\n", "2022-01-14\n", "2022-01-15\n", "2022-01-16\n", "2022-01-17\n", "2022-01-18\n", "2022-01-19\n", "2022-01-20\n", "2022-01-21\n", "2022-01-22\n", "2022-01-23\n", "2022-01-24\n", "2022-01-25\n", "2022-01-26\n", "2022-01-27\n", "2022-01-28\n", "2022-01-29\n", "2022-01-30\n", "2022-01-31\n", "2022-02-01\n", "2022-02-02\n", "2022-02-03\n", "2022-02-04\n", "2022-02-05\n", "2022-02-06\n", "2022-02-07\n", "2022-02-08\n", "2022-02-09\n", "2022-02-10\n", "2022-02-11\n", "2022-02-12\n", "2022-02-13\n", "2022-02-14\n", "2022-02-15\n", "2022-02-16\n", "2022-02-17\n", "2022-02-18\n", "2022-02-19\n", "2022-02-20\n", "2022-02-21\n", "2022-02-22\n", "2022-02-23\n", "2022-02-24\n", "2022-02-25\n", "2022-02-26\n", "2022-02-27\n", "2022-02-28\n", "2022-03-01\n", "2022-03-02\n", "2022-03-03\n", "2022-03-04\n", "2022-03-05\n", "2022-03-06\n", "2022-03-07\n", "2022-03-08\n", "2022-03-09\n", "2022-03-10\n", "2022-03-11\n", "2022-03-12\n", "2022-03-13\n", "2022-03-14\n", "2022-03-15\n", "2022-03-16\n", "2022-03-17\n", "2022-03-18\n", "2022-03-19\n", "2022-03-20\n", "2022-03-21\n", "2022-03-22\n", "2022-03-23\n", "2022-03-24\n", "2022-03-25\n", "2022-03-26\n", "2022-03-27\n", "2022-03-28\n", "2022-03-29\n", "2022-03-30\n", "2022-03-31\n", "2022-04-01\n", "2022-04-02\n", "2022-04-03\n", "2022-04-04\n", "2022-04-05\n", "2022-04-06\n", "2022-04-07\n", "2022-04-08\n", "2022-04-09\n", "2022-04-10\n", "2022-04-11\n", "2022-04-12\n", "2022-04-13\n", "2022-04-14\n", "2022-04-15\n", "2022-04-16\n", "2022-04-17\n", "2022-04-18\n", "2022-04-19\n", "2022-04-20\n", "2022-04-21\n", "2022-04-22\n", "2022-04-23\n", "2022-04-24\n", "2022-04-25\n", "2022-04-26\n", "2022-04-27\n", "2022-04-28\n", "2022-04-29\n", "2022-04-30\n", "2022-05-01\n", "2022-05-02\n", "2022-05-03\n", "2022-05-04\n", "2022-05-05\n", "2022-05-06\n", "2022-05-07\n", "2022-05-08\n", "2022-05-09\n", "2022-05-10\n", "2022-05-11\n", "2022-05-12\n", "2022-05-13\n", "2022-05-14\n", "2022-05-15\n", "2022-05-16\n", "2022-05-17\n", "2022-05-18\n", "2022-05-19\n", "2022-05-20\n", "2022-05-21\n", "2022-05-22\n", "2022-05-23\n", "2022-05-24\n", "2022-05-25\n", "2022-05-26\n", "2022-05-27\n", "2022-05-28\n", "2022-05-29\n", "2022-05-30\n", "2022-05-31\n", "2022-06-01\n", "2022-06-02\n", "2022-06-03\n", "2022-06-04\n", "2022-06-05\n", "2022-06-06\n", "2022-06-07\n", "2022-06-08\n", "2022-06-09\n", "2022-06-10\n", "2022-06-11\n", "2022-06-12\n", "2022-06-13\n", "2022-06-14\n", "2022-06-15\n", "2022-06-16\n", "2022-06-17\n", "2022-06-18\n", "2022-06-19\n", "2022-06-20\n", "2022-06-21\n", "2022-06-22\n", "2022-06-23\n", "2022-06-24\n", "2022-06-25\n", "2022-06-26\n", "2022-06-27\n", "2022-06-28\n", "2022-06-29\n", "2022-06-30\n", "2022-07-01\n", "2022-07-02\n", "2022-07-03\n", "2022-07-04\n", "2022-07-05\n", "2022-07-06\n", "2022-07-07\n", "2022-07-08\n", "2022-07-09\n", "2022-07-10\n", "2022-07-11\n", "2022-07-12\n", "2022-07-13\n", "2022-07-14\n", "2022-07-15\n", "2022-07-16\n", "2022-07-17\n", "2022-07-18\n", "2022-07-19\n", "2022-07-20\n", "2022-07-21\n", "2022-07-22\n", "2022-07-23\n", "2022-07-24\n", "2022-07-25\n", "2022-07-26\n", "2022-07-27\n", "2022-07-28\n", "2022-07-29\n", "2022-07-30\n", "2022-07-31\n", "2022-08-01\n", "2022-08-02\n", "2022-08-03\n", "2022-08-04\n", "2022-08-05\n", "2022-08-06\n", "2022-08-07\n", "2022-08-08\n", "2022-08-09\n", "2022-08-10\n", "2022-08-11\n", "2022-08-12\n", "2022-08-13\n", "2022-08-14\n", "2022-08-15\n", "2022-08-16\n", "2022-08-17\n", "2022-08-18\n", "2022-08-19\n", "2022-08-20\n", "2022-08-21\n", "2022-08-22\n", "2022-08-23\n", "2022-08-24\n", "2022-08-25\n", "2022-08-26\n", "2022-08-27\n", "2022-08-28\n", "2022-08-29\n", "2022-08-30\n", "2022-08-31\n", "2022-09-01\n", "2022-09-02\n", "2022-09-03\n", "2022-09-04\n", "2022-09-05\n", "2022-09-06\n", "2022-09-07\n", "2022-09-08\n", "2022-09-09\n", "2022-09-10\n", "2022-09-11\n", "2022-09-12\n", "2022-09-13\n", "2022-09-14\n", "2022-09-15\n", "2022-09-16\n", "2022-09-17\n", "2022-09-18\n", "2022-09-19\n", "2022-09-20\n", "2022-09-21\n", "2022-09-22\n", "2022-09-23\n", "2022-09-24\n", "2022-09-25\n", "2022-09-26\n", "2022-09-27\n", "2022-09-28\n", "2022-09-29\n", "2022-09-30\n", "2022-10-01\n", "2022-10-02\n", "2022-10-03\n", "2022-10-04\n", "2022-10-05\n", "2022-10-06\n", "2022-10-07\n", "2022-10-08\n", "2022-10-09\n", "2022-10-10\n", "2022-10-11\n", "2022-10-12\n", "2022-10-13\n", "2022-10-14\n", "2022-10-15\n", "2022-10-16\n", "2022-10-17\n", "2022-10-18\n", "2022-10-19\n", "2022-10-20\n", "2022-10-21\n", "2022-10-22\n", "2022-10-23\n", "2022-10-24\n", "2022-10-25\n", "2022-10-26\n", "2022-10-27\n", "2022-10-28\n", "2022-10-29\n", "2022-10-30\n", "2022-10-31\n", "2022-11-01\n", "2022-11-02\n", "2022-11-03\n", "2022-11-04\n", "2022-11-05\n", "2022-11-06\n", "2022-11-07\n", "2022-11-08\n", "2022-11-09\n", "2022-11-10\n", "2022-11-11\n", "2022-11-12\n", "2022-11-13\n", "2022-11-14\n", "2022-11-15\n", "2022-11-16\n", "2022-11-17\n", "2022-11-18\n", "2022-11-19\n", "2022-11-20\n", "2022-11-21\n", "2022-11-22\n", "2022-11-23\n", "2022-11-24\n", "2022-11-25\n", "2022-11-26\n", "2022-11-27\n", "2022-11-28\n", "2022-11-29\n", "2022-11-30\n", "2022-12-01\n", "2022-12-02\n", "2022-12-03\n", "2022-12-04\n", "2022-12-05\n", "2022-12-06\n", "2022-12-07\n", "2022-12-08\n", "2022-12-09\n", "2022-12-10\n", "2022-12-11\n", "2022-12-12\n", "2022-12-13\n", "2022-12-14\n", "2022-12-15\n", "2022-12-16\n", "2022-12-17\n", "2022-12-18\n", "2022-12-19\n", "2022-12-20\n", "2022-12-21\n", "2022-12-22\n", "2022-12-23\n", "2022-12-24\n", "2022-12-25\n", "2022-12-26\n", "2022-12-27\n", "2022-12-28\n", "2022-12-29\n", "2022-12-30\n", "2022-12-31\n", "2023-01-01\n", "2023-01-02\n", "2023-01-03\n", "2023-01-04\n", "2023-01-05\n", "2023-01-06\n", "2023-01-07\n", "2023-01-08\n", "2023-01-09\n", "2023-01-10\n", "2023-01-11\n", "2023-01-12\n", "2023-01-13\n", "2023-01-14\n", "2023-01-15\n", "2023-01-16\n", "2023-01-17\n", "2023-01-18\n", "2023-01-19\n", "2023-01-20\n", "2023-01-21\n", "2023-01-22\n", "2023-01-23\n", "2023-01-24\n", "2023-01-25\n", "2023-01-26\n", "2023-01-27\n", "2023-01-28\n", "2023-01-29\n", "2023-01-30\n", "2023-01-31\n", "2023-02-01\n", "2023-02-02\n", "2023-02-03\n", "2023-02-04\n", "2023-02-05\n", "2023-02-06\n", "2023-02-07\n", "2023-02-08\n", "2023-02-09\n", "2023-02-10\n", "2023-02-11\n", "2023-02-12\n", "2023-02-13\n", "2023-02-14\n", "2023-02-15\n", "2023-02-16\n", "2023-02-17\n", "2023-02-18\n", "2023-02-19\n", "2023-02-20\n", "2023-02-21\n", "2023-02-22\n", "2023-02-23\n", "2023-02-24\n", "2023-02-25\n", "2023-02-26\n", "2023-02-27\n", "2023-02-28\n", "2023-03-01\n", "2023-03-02\n", "2023-03-03\n", "2023-03-04\n", "2023-03-05\n", "2023-03-06\n", "2023-03-07\n", "2023-03-08\n", "2023-03-09\n", "2023-03-10\n", "2023-03-11\n", "2023-03-12\n", "2023-03-13\n", "2023-03-14\n", "2023-03-15\n", "2023-03-16\n", "2023-03-17\n", "2023-03-18\n", "2023-03-19\n", "2023-03-20\n", "2023-03-21\n", "2023-03-22\n", "2023-03-23\n", "2023-03-24\n", "2023-03-25\n", "2023-03-26\n", "2023-03-27\n", "2023-03-28\n", "2023-03-29\n", "2023-03-30\n", "2023-03-31\n", "2023-04-01\n", "2023-04-02\n", "2023-04-03\n", "2023-04-04\n", "2023-04-05\n", "2023-04-06\n", "2023-04-07\n", "2023-04-08\n", "2023-04-09\n", "2023-04-10\n", "2023-04-11\n", "2023-04-12\n", "2023-04-13\n", "2023-04-14\n", "2023-04-15\n", "2023-04-16\n", "2023-04-17\n", "2023-04-18\n", "2023-04-19\n", "2023-04-20\n", "2023-04-21\n", "2023-04-22\n", "2023-04-23\n", "2023-04-24\n", "2023-04-25\n", "2023-04-26\n", "2023-04-27\n", "2023-04-28\n", "2023-04-29\n", "2023-04-30\n", "2023-05-01\n", "2023-05-02\n", "2023-05-03\n", "2023-05-04\n", "2023-05-05\n", "2023-05-06\n", "2023-05-07\n", "2023-05-08\n", "2023-05-09\n", "2023-05-10\n", "2023-05-11\n", "2023-05-12\n", "2023-05-13\n", "2023-05-14\n", "2023-05-15\n", "2023-05-16\n", "2023-05-17\n", "2023-05-18\n", "2023-05-19\n", "2023-05-20\n", "2023-05-21\n", "2023-05-22\n", "2023-05-23\n", "2023-05-24\n", "2023-05-25\n", "2023-05-26\n", "2023-05-27\n", "2023-05-28\n", "2023-05-29\n", "2023-05-30\n", "2023-05-31\n", "2023-06-01\n", "2023-06-02\n", "2023-06-03\n", "2023-06-04\n", "2023-06-05\n", "2023-06-06\n", "2023-06-07\n", "2023-06-08\n", "2023-06-09\n", "2023-06-10\n", "2023-06-11\n", "2023-06-12\n", "2023-06-13\n", "2023-06-14\n", "2023-06-15\n", "2023-06-16\n", "2023-06-17\n", "2023-06-18\n", "2023-06-19\n", "2023-06-20\n", "2023-06-21\n", "2023-06-22\n", "2023-06-23\n", "2023-06-24\n", "2023-06-25\n", "2023-06-26\n", "2023-06-27\n", "2023-06-28\n", "2023-06-29\n", "2023-06-30\n", "2023-07-01\n", "2023-07-02\n", "2023-07-03\n", "2023-07-04\n", "2023-07-05\n", "2023-07-06\n", "2023-07-07\n", "2023-07-08\n", "2023-07-09\n", "2023-07-10\n", "2023-07-11\n", "2023-07-12\n", "2023-07-13\n", "2023-07-14\n", "2023-07-15\n", "2023-07-16\n", "2023-07-17\n", "2023-07-18\n", "2023-07-19\n", "2023-07-20\n", "2023-07-21\n", "2023-07-22\n", "2023-07-23\n", "2023-07-24\n", "2023-07-25\n", "2023-07-26\n", "2023-07-27\n", "2023-07-28\n", "2023-07-29\n", "2023-07-30\n", "2023-07-31\n", "2023-08-01\n", "2023-08-02\n", "2023-08-03\n", "2023-08-04\n", "2023-08-05\n", "2023-08-06\n", "2023-08-07\n", "2023-08-08\n", "2023-08-09\n", "2023-08-10\n", "2023-08-11\n", "2023-08-12\n", "2023-08-13\n", "2023-08-14\n", "2023-08-15\n", "2023-08-16\n", "2023-08-17\n", "2023-08-18\n", "2023-08-19\n", "2023-08-20\n", "2023-08-21\n", "2023-08-22\n", "2023-08-23\n", "2023-08-24\n", "2023-08-25\n", "2023-08-26\n", "2023-08-27\n", "2023-08-28\n", "2023-08-29\n", "2023-08-30\n", "2023-08-31\n", "2023-09-01\n", "2023-09-02\n", "2023-09-03\n", "2023-09-04\n", "2023-09-05\n", "2023-09-06\n", "2023-09-07\n", "2023-09-08\n", "2023-09-09\n", "2023-09-10\n", "2023-09-11\n", "2023-09-12\n", "2023-09-13\n", "2023-09-14\n", "2023-09-15\n", "2023-09-16\n", "2023-09-17\n", "2023-09-18\n", "2023-09-19\n", "2023-09-20\n", "2023-09-21\n", "2023-09-22\n", "2023-09-23\n", "2023-09-24\n", "2023-09-25\n", "2023-09-26\n", "2023-09-27\n", "2023-09-28\n", "2023-09-29\n", "2023-09-30\n", "2023-10-01\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2023-10-02\n", "2023-10-03\n", "2023-10-04\n", "2023-10-05\n", "2023-10-06\n", "2023-10-07\n", "2023-10-08\n", "2023-10-09\n", "2023-10-10\n", "2023-10-11\n", "2023-10-12\n", "2023-10-13\n", "2023-10-14\n", "2023-10-15\n", "2023-10-16\n", "2023-10-17\n", "2023-10-18\n", "2023-10-19\n", "2023-10-20\n", "2023-10-21\n", "2023-10-22\n", "2023-10-23\n", "2023-10-24\n", "2023-10-25\n", "2023-10-26\n", "2023-10-27\n", "2023-10-28\n", "2023-10-29\n", "2023-10-30\n", "2023-10-31\n", "2023-11-01\n", "2023-11-02\n", "2023-11-03\n", "2023-11-04\n", "2023-11-05\n", "2023-11-06\n", "2023-11-07\n", "2023-11-08\n", "2023-11-09\n", "2023-11-10\n", "2023-11-11\n", "2023-11-12\n", "2023-11-13\n", "2023-11-14\n", "2023-11-15\n", "2023-11-16\n", "2023-11-17\n", "2023-11-18\n", "2023-11-19\n", "2023-11-20\n", "2023-11-21\n", "2023-11-22\n", "2023-11-23\n", "2023-11-24\n", "2023-11-25\n", "2023-11-26\n", "2023-11-27\n", "2023-11-28\n", "2023-11-29\n", "2023-11-30\n", "2023-12-01\n", "2023-12-02\n", "2023-12-03\n", "2023-12-04\n", "2023-12-05\n", "2023-12-06\n", "2023-12-07\n", "2023-12-08\n", "2023-12-09\n", "2023-12-10\n", "2023-12-11\n", "2023-12-12\n", "2023-12-13\n", "2023-12-14\n", "2023-12-15\n", "2023-12-16\n", "2023-12-17\n", "2023-12-18\n", "2023-12-19\n", "2023-12-20\n", "2023-12-21\n", "2023-12-22\n", "2023-12-23\n", "2023-12-24\n", "2023-12-25\n", "2023-12-26\n", "2023-12-27\n", "2023-12-28\n", "2023-12-29\n", "2023-12-30\n", "2023-12-31\n", "2024-01-01\n", "2024-01-02\n", "2024-01-03\n", "2024-01-04\n", "2024-01-05\n", "2024-01-06\n", "2024-01-07\n", "2024-01-08\n", "2024-01-09\n", "2024-01-10\n", "2024-01-11\n", "2024-01-12\n", "2024-01-13\n", "2024-01-14\n", "2024-01-15\n", "2024-01-16\n", "2024-01-17\n", "2024-01-18\n", "2024-01-19\n", "2024-01-20\n", "2024-01-21\n", "2024-01-22\n", "2024-01-23\n", "2024-01-24\n", "2024-01-25\n", "2024-01-26\n", "2024-01-27\n", "2024-01-28\n", "2024-01-29\n", "2024-01-30\n", "2024-01-31\n", "2024-02-01\n", "2024-02-02\n", "2024-02-03\n", "2024-02-04\n", "2024-02-05\n", "2024-02-06\n", "2024-02-07\n", "2024-02-08\n", "2024-02-09\n", "2024-02-10\n", "2024-02-11\n", "2024-02-12\n", "2024-02-13\n", "2024-02-14\n", "2024-02-15\n", "2024-02-16\n", "2024-02-17\n", "2024-02-18\n", "2024-02-19\n", "2024-02-20\n", "2024-02-21\n", "2024-02-22\n", "2024-02-23\n", "2024-02-24\n", "2024-02-25\n", "2024-02-26\n", "2024-02-27\n", "2024-02-28\n", "2024-02-29\n", "2024-03-01\n", "2024-03-02\n", "2024-03-03\n", "2024-03-04\n", "2024-03-05\n", "2024-03-06\n", "2024-03-07\n", "2024-03-08\n", "2024-03-09\n", "2024-03-10\n", "2024-03-11\n", "2024-03-12\n", "2024-03-13\n", "2024-03-14\n", "2024-03-15\n", "2024-03-16\n", "2024-03-17\n", "2024-03-18\n", "2024-03-19\n", "2024-03-20\n", "2024-03-21\n", "2024-03-22\n", "2024-03-23\n", "2024-03-24\n", "2024-03-25\n", "2024-03-26\n", "2024-03-27\n", "2024-03-28\n", "2024-03-29\n", "2024-03-30\n", "2024-03-31\n", "2024-04-01\n", "2024-04-02\n", "2024-04-03\n", "2024-04-04\n", "2024-04-05\n", "2024-04-06\n", "2024-04-07\n", "2024-04-08\n", "2024-04-09\n", "2024-04-10\n", "2024-04-11\n", "2024-04-12\n", "2024-04-13\n", "2024-04-14\n", "2024-04-15\n", "2024-04-16\n", "2024-04-17\n", "2024-04-18\n", "2024-04-19\n", "2024-04-20\n", "2024-04-21\n", "2024-04-22\n", "2024-04-23\n", "2024-04-24\n", "2024-04-25\n", "2024-04-26\n", "2024-04-27\n", "2024-04-28\n", "2024-04-29\n", "2024-04-30\n", "2024-05-01\n", "2024-05-02\n", "2024-05-03\n", "2024-05-04\n", "2024-05-05\n", "2024-05-06\n", "2024-05-07\n", "2024-05-08\n", "2024-05-09\n", "2024-05-10\n", "2024-05-11\n", "2024-05-12\n", "2024-05-13\n", "2024-05-14\n", "2024-05-15\n", "2024-05-16\n", "2024-05-17\n", "2024-05-18\n", "2024-05-19\n", "2024-05-20\n", "2024-05-21\n", "2024-05-22\n", "2024-05-23\n", "2024-05-24\n", "2024-05-25\n", "2024-05-26\n", "2024-05-27\n", "2024-05-28\n", "2024-05-29\n", "2024-05-30\n", "2024-05-31\n", "2024-06-01\n", "2024-06-02\n", "2024-06-03\n", "2024-06-04\n", "2024-06-05\n", "2024-06-06\n", "2024-06-07\n", "2024-06-08\n", "2024-06-09\n", "2024-06-10\n", "2024-06-11\n", "2024-06-12\n", "2024-06-13\n", "2024-06-14\n", "2024-06-15\n", "2024-06-16\n", "2024-06-17\n", "2024-06-18\n", "2024-06-19\n", "2024-06-20\n", "2024-06-21\n", "2024-06-22\n", "2024-06-23\n", "2024-06-24\n", "2024-06-25\n", "2024-06-26\n", "2024-06-27\n", "2024-06-28\n", "2024-06-29\n", "2024-06-30\n", "program done\n" ] } ], "source": [ "#just a little experiment\n", "\n", "#in this we assume that party positions remain the same during the next assembly term of each state\n", "#and we try and see how alliance strength in the RS changes as a result\n", "\n", "#so here there won't be the issue that we can't say something about a RS seat election because it is being contested\n", " #after the term of the state assembly is over\n", "\n", "import csv\n", "import datetime\n", "import pandas as pd\n", "import collections\n", "import math\n", "\n", "df_assembly_dates = pd.read_csv('assembly_end_dates.csv')\n", "\n", "df_assembly_dates['term_ends'] = pd.to_datetime(df_assembly_dates['term_ends'], format=\"%d-%m-%Y\").dt.date\n", "\n", "df_assembly_data = pd.read_csv('assembly_alliances_strength.csv')\n", "\n", "df_rs_data = pd.read_csv('rajya_sabha_alliances_strength.csv')\n", "\n", "df_rs_data['retirement_date'] = pd.to_datetime(df_rs_data['retirement_date'], format=\"%d-%m-%Y\").dt.date\n", "\n", "headings = ['date', 'NDA', 'UPA', 'Others']\n", "\n", "with open(\"alliances_over_time_experiment.csv\", \"wb\") as filex: \n", " wr = csv.writer(filex, delimiter = ',' , quotechar = '\"' )\n", " wr.writerow(headings)\n", "\n", "start = datetime.datetime.strptime(\"19-08-2017\", \"%d-%m-%Y\")\n", "end = datetime.datetime.strptime(\"01-07-2024\", \"%d-%m-%Y\")\n", "date_generated = [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)]\n", "\n", "for this_date_raw in date_generated:\n", " this_date = this_date_raw.date()\n", " print this_date\n", " NDA = 0\n", " UPA = 0\n", " \n", " for index, row in df_rs_data.iterrows():\n", "\n", " rs_seat_retirement_date = row['retirement_date']\n", " \n", " alliance = row['alliance']\n", " \n", " state = row['state']\n", " \n", " rs_mp_name = row['name'] #note this could be marked 'VACANT' too, have contingency plans for that\n", " \n", " if state != 'Nominated':\n", " \n", " assembly_end_date = df_assembly_dates[df_assembly_dates['state'] == state]['term_ends'].values[0]\n", " \n", " #assembly_end_dates only matter for how seats marked VACANT are filled before their terms are over\n", " #otherwise in this experiment party positions are permanent\n", "\n", "\n", " if this_date <= rs_seat_retirement_date:\n", " if rs_mp_name != 'VACANT':\n", "\n", " if alliance == 'NDA':\n", " NDA += 1\n", " elif alliance == 'UPA':\n", " UPA += 1\n", "\n", " else: #if seat is vacant\n", "\n", " if this_date <= assembly_end_date: #you need to only check assembly end date for seats VACANT now\n", "\n", " diff_bw_this_date_retirement_date = rs_seat_retirement_date - this_date\n", "\n", " if diff_bw_this_date_retirement_date.days > 365: #am I doubling up conditions?\n", "\n", "\n", " next_any_state_retirement_date = df_rs_data[(df_rs_data['retirement_date'] >= this_date) &\\\n", " (df_rs_data['retirement_date'] < rs_seat_retirement_date)].min()[\"retirement_date\"]\n", "\n", " date_difference_any_state = rs_seat_retirement_date - next_any_state_retirement_date\n", "\n", " if date_difference_any_state.days > 365:\n", "\n", " if this_date > next_any_state_retirement_date:\n", "\n", " seats_vacant_now_state_v2 = len(df_rs_data[(df_rs_data['state'] == state) &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date) &\\\n", " (rs_mp_name == 'VACANT')])\n", "\n", " assembly_seats_total_v2 = df_assembly_data[df_assembly_data['state'] == state].sum()[\"seats\"]\n", "\n", " droop_quota_v2 = math.floor((assembly_seats_total_v2 * 100)/(seats_vacant_now_state_v2 + 1)) + 1\n", "\n", " nda_strength_v2 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "\n", " upa_strength_v2 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " nda_seats_v2 = math.floor((nda_strength_v2 * 100)/droop_quota_v2)\n", "\n", " upa_seats_v2 = math.floor((upa_strength_v2 * 100)/droop_quota_v2)\n", "\n", " NDA += nda_seats_v2/seats_vacant_now_state_v2\n", "\n", " UPA += upa_seats_v2/seats_vacant_now_state_v2\n", " \n", " else: # ie. this_date > rs_seat_retirement_date\n", "\n", " if state not in ['Delhi', 'Punjab']:\n", "\n", " vacancies_number_v3 = len(df_rs_data[(df_rs_data['state'] == state) &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date)])\n", "\n", " assembly_seats_total_v3 = df_assembly_data[df_assembly_data['state'] == state].sum()[\"seats\"]\n", "\n", " droop_quota_v3 = math.floor((assembly_seats_total_v3 * 100)/(vacancies_number_v3 + 1)) + 1\n", "\n", " nda_strength_v3 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "\n", " upa_strength_v3 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " nda_seats_v3 = math.floor((nda_strength_v3 * 100)/droop_quota_v3)\n", "\n", " upa_seats_v3 = math.floor((upa_strength_v3 * 100)/droop_quota_v3)\n", "\n", " NDA += nda_seats_v3/vacancies_number_v3\n", "\n", " UPA += upa_seats_v3/vacancies_number_v3\n", "\n", " elif state == 'Delhi':\n", "\n", " vacancies_number_d = 1 \n", "\n", " assembly_seats_total_d = df_assembly_data[df_assembly_data['state'] == 'Delhi'].sum()[\"seats\"]\n", "\n", " droop_quota_d = math.floor((assembly_seats_total_d * 100)/(vacancies_number_d + 1)) + 1\n", "\n", " nda_strength_d = df_assembly_data[(df_assembly_data['state'] == 'Delhi') &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "\n", " upa_strength_d = df_assembly_data[(df_assembly_data['state'] == 'Delhi') &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " nda_seats_d = math.floor((nda_strength_d * 100)/droop_quota_d)\n", "\n", " upa_seats_d = math.floor((upa_strength_d * 100)/droop_quota_d)\n", "\n", " NDA += nda_seats_d \n", "\n", " UPA += upa_seats_d \n", "\n", " elif state == 'Punjab':\n", "\n", " punjab_dates_list = df_rs_data[df_rs_data['state'] == 'Punjab']['retirement_date'].tolist()\n", "\n", " punjab_dates_freq = dict(collections.Counter(punjab_dates_list))\n", "\n", " if punjab_dates_freq[rs_seat_retirement_date] == 5: \n", "\n", " vacancies_number_p_g2 = 2\n", "\n", " vacancies_number_p_g3 = 3\n", "\n", " assembly_seats_total_p = df_assembly_data[df_assembly_data['state'] == 'Punjab'].sum()[\"seats\"] \n", "\n", " droop_quota_p_g2 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p_g2 + 1)) + 1\n", "\n", " droop_quota_p_g3 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p_g3 + 1)) + 1\n", "\n", " nda_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "\n", " upa_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " nda_seats_p_g2 = math.floor((nda_strength_p * 100)/droop_quota_p_g2)\n", "\n", " upa_seats_p_g2 = math.floor((upa_strength_p * 100)/droop_quota_p_g2)\n", "\n", " nda_seats_p_g3 = math.floor((nda_strength_p * 100)/droop_quota_p_g3)\n", "\n", " upa_seats_p_g3 = math.floor((upa_strength_p * 100)/droop_quota_p_g3)\n", "\n", " NDA += (nda_seats_p_g2 + nda_seats_p_g3)/5 \n", "\n", " UPA += (upa_seats_p_g2 + upa_seats_p_g3)/5 \n", "\n", "\n", " else:\n", "\n", " vacancies_number_p2 = len(df_rs_data[(df_rs_data['state'] == 'Punjab') &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date)])\n", "\n", " assembly_seats_total_p = df_assembly_data[df_assembly_data['state'] == 'Punjab'].sum()[\"seats\"]\n", "\n", " droop_quota_p2 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p2 + 1)) + 1\n", "\n", " nda_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "\n", " upa_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " nda_seats_p2 = math.floor((nda_strength_p * 100)/droop_quota_p2)\n", "\n", " upa_seats_p2 = math.floor((upa_strength_p * 100)/droop_quota_p2)\n", "\n", " NDA += nda_seats_p2/vacancies_number_p2 \n", "\n", " UPA += upa_seats_p2/vacancies_number_p2 \n", " \n", " else: #if MP is nominated\n", " if this_date <= rs_seat_retirement_date:\n", " if alliance == 'NDA':\n", " NDA += 1\n", " elif alliance == 'UPA':\n", " UPA += 1\n", " #no else condition here, if after retirement date, we can't say anything about who will get nominated\n", " #and if they are otherwise politically affiliated or not\n", "\n", " OTHERS = 245 - (NDA + UPA)\n", " \n", " csv_row = list()\n", " csv_row.append(this_date)\n", " csv_row.append(NDA)\n", " csv_row.append(UPA)\n", " csv_row.append(OTHERS)\n", " \n", " with open(\"alliances_over_time_experiment.csv\", \"ab\") as filez:\n", " wrz = csv.writer(filez, delimiter = ',' , quotechar = '\"' )\n", " wrz.writerow(csv_row)\n", "\n", "filez.close()\n", "\n", "print \"program done\"" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dateNDAUPAOthers
02017-08-1983.063.099.0
12017-08-2083.063.099.0
22017-08-2183.063.099.0
32017-08-2283.063.099.0
42017-08-2383.063.099.0
\n", "
" ], "text/plain": [ " date NDA UPA Others\n", "0 2017-08-19 83.0 63.0 99.0\n", "1 2017-08-20 83.0 63.0 99.0\n", "2 2017-08-21 83.0 63.0 99.0\n", "3 2017-08-22 83.0 63.0 99.0\n", "4 2017-08-23 83.0 63.0 99.0" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_real = pd.read_csv('alliances_over_time_realistic.csv')\n", "df_exp = pd.read_csv('alliances_over_time_experiment.csv')\n", "\n", "df_real.head()" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dateNDAUPAOthers
02017-08-1983.063.099.0
12017-08-2083.063.099.0
22017-08-2183.063.099.0
32017-08-2283.063.099.0
42017-08-2383.063.099.0
\n", "
" ], "text/plain": [ " date NDA UPA Others\n", "0 2017-08-19 83.0 63.0 99.0\n", "1 2017-08-20 83.0 63.0 99.0\n", "2 2017-08-21 83.0 63.0 99.0\n", "3 2017-08-22 83.0 63.0 99.0\n", "4 2017-08-23 83.0 63.0 99.0" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_exp.head()" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
datendaupaoth
02017-08-1983.063.099.0
12017-08-2083.063.099.0
22017-08-2183.063.099.0
32017-08-2283.063.099.0
42017-08-2383.063.099.0
\n", "
" ], "text/plain": [ " date nda upa oth\n", "0 2017-08-19 83.0 63.0 99.0\n", "1 2017-08-20 83.0 63.0 99.0\n", "2 2017-08-21 83.0 63.0 99.0\n", "3 2017-08-22 83.0 63.0 99.0\n", "4 2017-08-23 83.0 63.0 99.0" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#change all column names to lower case, seems d3 doesn't deal well with column names that are all upper case or\n", " #has underscores in them or is more than 4 letters long. Since when?? I must be doing sthing wrong elsewhere\n", "\n", "df_real = df_real.rename(columns={'NDA': 'nda', 'UPA': 'upa', 'Others': 'oth' })\n", "df_real.head()" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
datendaxupaxothx
02017-08-1983.063.099.0
12017-08-2083.063.099.0
22017-08-2183.063.099.0
32017-08-2283.063.099.0
42017-08-2383.063.099.0
\n", "
" ], "text/plain": [ " date ndax upax othx\n", "0 2017-08-19 83.0 63.0 99.0\n", "1 2017-08-20 83.0 63.0 99.0\n", "2 2017-08-21 83.0 63.0 99.0\n", "3 2017-08-22 83.0 63.0 99.0\n", "4 2017-08-23 83.0 63.0 99.0" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_exp = df_exp.rename(columns={'NDA': 'ndax', 'UPA': 'upax', 'Others': 'othx' })\n", "df_exp.head()" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
datendaupaothndaxupaxothx
02017-08-1983.063.099.083.063.099.0
12017-08-2083.063.099.083.063.099.0
22017-08-2183.063.099.083.063.099.0
32017-08-2283.063.099.083.063.099.0
42017-08-2383.063.099.083.063.099.0
\n", "
" ], "text/plain": [ " date nda upa oth ndax upax othx\n", "0 2017-08-19 83.0 63.0 99.0 83.0 63.0 99.0\n", "1 2017-08-20 83.0 63.0 99.0 83.0 63.0 99.0\n", "2 2017-08-21 83.0 63.0 99.0 83.0 63.0 99.0\n", "3 2017-08-22 83.0 63.0 99.0 83.0 63.0 99.0\n", "4 2017-08-23 83.0 63.0 99.0 83.0 63.0 99.0" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "combined = pd.merge(df_real, df_exp, on=['date'])\n", "combined.head()" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "collapsed": true }, "outputs": [], "source": [ "combined.to_csv('alliances_strength_combined.csv', index=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2018-04-04\n", "The no. of seats added for NDA is 31.0.\n", "The no. of seats added for UPA is 6.0.\n", "The no. of vacancies is 60.\n", "The no. of vacancies before assembly end is 60.\n", "program done\n" ] } ], "source": [ "#this code block isn't important, used it to check and test subsets of my data\n", "\n", "import csv\n", "import datetime\n", "import pandas as pd\n", "import collections\n", "import math\n", "\n", "df_assembly_dates = pd.read_csv('assembly_end_dates.csv')\n", "\n", "df_assembly_dates['term_ends'] = pd.to_datetime(df_assembly_dates['term_ends'], format=\"%d-%m-%Y\").dt.date\n", " \n", "df_assembly_data = pd.read_csv('assembly_alliances_strength.csv')\n", "\n", "df_rs_data = pd.read_csv('rajya_sabha_alliances_strength.csv')\n", "\n", "df_rs_data['retirement_date'] = pd.to_datetime(df_rs_data['retirement_date'], format=\"%d-%m-%Y\").dt.date\n", "\n", "\n", "headings = ['date', 'NDA', 'UPA', 'Others']\n", "\n", "start = datetime.datetime.strptime(\"04-04-2018\", \"%d-%m-%Y\")\n", "end = datetime.datetime.strptime(\"05-04-2018\", \"%d-%m-%Y\")\n", "date_generated = [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)]\n", "\n", "for this_date_raw in date_generated:\n", " this_date = this_date_raw.date()\n", " print this_date\n", " NDA = 0\n", " UPA = 0\n", " NOM = 0\n", " seats_post_retirement = 0\n", " seats_post_retirement_before_assembly_end = 0\n", " \n", " for index, row in df_rs_data.iterrows():\n", " rs_seat_retirement_date = row['retirement_date']\n", "\n", " alliance = row['alliance']\n", " \n", " state = row['state']\n", " \n", " rs_mp_name = row['name'] #note this could be marked 'VACANT' too, have contingency plans for that\n", " \n", " if state != 'Nominated':\n", " \n", "\n", " assembly_end_date = df_assembly_dates[df_assembly_dates['state'] == state]['term_ends'].values[0]\n", " \n", "# if this_date <= rs_seat_retirement_date: \n", "# if rs_mp_name != 'VACANT':\n", "\n", "# if alliance == 'NDA':\n", "# NDA += 1\n", "# elif alliance == 'UPA':\n", "# UPA += 1\n", "\n", "# else: # ie. if seat is marked 'vacant'\n", "\n", "# if this_date <= assembly_end_date:\n", "\n", "# diff_bw_this_date_retirement_date = rs_seat_retirement_date - this_date\n", "\n", "# if diff_bw_this_date_retirement_date.days > 365:\n", "\n", "# next_any_state_retirement_date = df_rs_data[(df_rs_data['retirement_date'] >= this_date) &\\\n", "# (df_rs_data['retirement_date'] < rs_seat_retirement_date)].min()[\"retirement_date\"]\n", "\n", "# date_difference_any_state = rs_seat_retirement_date - next_any_state_retirement_date\n", "\n", "# if date_difference_any_state.days > 365:\n", "\n", "# if this_date > next_any_state_retirement_date:\n", "\n", "# seats_vacant_now_state2 = len(df_rs_data[(df_rs_data['state'] == state) &\\\n", "# (df_rs_data['retirement_date'] == rs_seat_retirement_date) &\\\n", "# (rs_mp_name == 'VACANT')])\n", "\n", "# assembly_seats_total_v2 = df_assembly_data[df_assembly_data['state'] == state].sum()[\"seats\"]\n", "\n", "# droop_quota_v2 = math.floor((assembly_seats_total_v2 * 100)/(seats_vacant_now_state2 + 1)) + 1\n", "\n", "# nda_strength_v2 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", "# (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "# #code above from https://stackoverflow.com/a/20995313\n", "\n", "# upa_strength_v2 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", "# (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", "# nda_seats_v2 = math.floor((nda_strength_v2 * 100)/droop_quota_v2)\n", "\n", "# upa_seats_v2 = math.floor((upa_strength_v2 * 100)/droop_quota_v2)\n", "\n", "# NDA += nda_seats_v2/seats_vacant_now_state2\n", "\n", "# UPA += upa_seats_v2/seats_vacant_now_state2\n", "\n", "# else: # ie. this_date > rs_seat_retirement_date\n", "\n", " if this_date > rs_seat_retirement_date:\n", " \n", " seats_post_retirement += 1\n", " \n", "# if this_date <= assembly_end_date:\n", " # if state =='Uttar Pradesh':\n", "\n", " seats_post_retirement_before_assembly_end += 1\n", "\n", "# if state not in ['Delhi', 'Punjab']:\n", "\n", " vacancies_number_v3 = len(df_rs_data[(df_rs_data['state'] == state) &\\\n", " (df_rs_data['retirement_date'] == rs_seat_retirement_date)])\n", "\n", " #print \"there are {} vacancies.\".format(vacancies_number_v3)\n", "\n", " assembly_seats_total_v3 = df_assembly_data[df_assembly_data['state'] == state].sum()[\"seats\"]\n", "\n", " #print \"there are {} assembly seats.\".format(assembly_seats_total_v3)\n", "\n", " droop_quota_v3 = math.floor((assembly_seats_total_v3 * 100)/(vacancies_number_v3 + 1)) + 1\n", "\n", " #print \"the droop quota is {}.\".format(droop_quota_v3)\n", "\n", " nda_strength_v3 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", " #code above from https://stackoverflow.com/a/20995313\n", "\n", " #print \"the nda_strength is {}.\".format(nda_strength_v3)\n", "\n", " upa_strength_v3 = df_assembly_data[(df_assembly_data['state'] == state) &\\\n", " (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", " #print \"the upa_strength is {}.\".format(upa_strength_v3)\n", "\n", " nda_seats_v3 = math.floor((nda_strength_v3 * 100)/droop_quota_v3)\n", "\n", " #print \"the nda seats are {}.\".format(nda_seats_v3)\n", "\n", " upa_seats_v3 = math.floor((upa_strength_v3 * 100)/droop_quota_v3)\n", "\n", " #print \"the upa seats are {}.\".format(upa_seats_v3)\n", "\n", " NDA += nda_seats_v3/vacancies_number_v3\n", "\n", " #print \"what will get added to NDA variable is {}.\".format(NDA)\n", "\n", " UPA += upa_seats_v3/vacancies_number_v3\n", "\n", " #print \"what will get added to UPA variable is {}.\".format(UPA)\n", "\n", "# elif state == 'Delhi':\n", "\n", "# vacancies_number_d = 1 \n", "\n", "# assembly_seats_total_d = df_assembly_data[df_assembly_data['state'] == 'Delhi'].sum()[\"seats\"]\n", "\n", "# droop_quota_d = math.floor((assembly_seats_total_d * 100)/(vacancies_number_d + 1)) + 1\n", "\n", "# nda_strength_d = df_assembly_data[(df_assembly_data['state'] == 'Delhi') &\\\n", "# (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "# #code above from https://stackoverflow.com/a/20995313\n", "\n", "# upa_strength_d = df_assembly_data[(df_assembly_data['state'] == 'Delhi') &\\\n", "# (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", "# nda_seats_d = math.floor((nda_strength_d * 100)/droop_quota_d)\n", "\n", "# upa_seats_d = math.floor((upa_strength_d * 100)/droop_quota_d)\n", "\n", "# NDA += nda_seats_d #Do I need to divide by vacancies_number_d here? No\n", "\n", "# UPA += upa_seats_d \n", "\n", "# elif state == 'Punjab':\n", "\n", "# punjab_dates_list = df_rs_data[df_rs_data['state'] == 'Punjab']['retirement_date'].tolist()\n", "\n", "# punjab_dates_freq = dict(collections.Counter(punjab_dates_list))\n", "\n", "# if punjab_dates_freq[rs_seat_retirement_date] == 5: #if the retirement date is the one for the five seats\n", "\n", "# vacancies_number_p_g2 = 2 #g2 for group of two\n", "\n", "# vacancies_number_p_g3 = 3 #g3 for group of three\n", "\n", "# assembly_seats_total_p = df_assembly_data[df_assembly_data['state'] == 'Punjab'].sum()[\"seats\"] \n", "\n", "# droop_quota_p_g2 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p_g2 + 1)) + 1\n", "\n", "# droop_quota_p_g3 = math.floor((assembly_seats_total_p * 100)/(vacancies_number_p_g3 + 1)) + 1\n", "\n", "# nda_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", "# (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "# #code above from https://stackoverflow.com/a/20995313\n", "\n", "# upa_strength_p = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", "# (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", "# nda_seats_p_g2 = math.floor((nda_strength_p * 100)/droop_quota_p_g2)\n", "\n", "# upa_seats_p_g2 = math.floor((upa_strength_p * 100)/droop_quota_p_g2)\n", "\n", "# nda_seats_p_g3 = math.floor((nda_strength_p * 100)/droop_quota_p_g3)\n", "\n", "# upa_seats_p_g3 = math.floor((upa_strength_p * 100)/droop_quota_p_g3)\n", "\n", "# NDA += (nda_seats_p_g2 + nda_seats_p_g3)/5 #Is dividing by 5 the right thing here?\n", "\n", "# UPA += (upa_seats_p_g2 + upa_seats_p_g3)/5 \n", "\n", "\n", "# else: #if it's the group of two RS seats from Punjab that share the same retirement date\n", "\n", "# vacancies_number_p2 = len(df_rs_data[(df_rs_data['state'] == 'Punjab') &\\\n", "# (df_rs_data['retirement_date'] == rs_seat_retirement_date)])\n", "\n", "# assembly_seats_total_p2 = df_assembly_data[df_assembly_data['state'] == 'Punjab'].sum()[\"seats\"]\n", "\n", "# droop_quota_p2 = math.floor((assembly_seats_total_p2 * 100)/(vacancies_number_p2 + 1)) + 1\n", "\n", "# nda_strength_p2 = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", "# (df_assembly_data['alliance'] == \"NDA\")].sum()[\"seats\"]\n", "# #code above from https://stackoverflow.com/a/20995313\n", "\n", "# upa_strength_p2 = df_assembly_data[(df_assembly_data['state'] == 'Punjab') &\\\n", "# (df_assembly_data['alliance'] == \"UPA\")].sum()[\"seats\"]\n", "\n", "# #below I'm calculating the number of seats any party will get in an RS election for a \n", "# #specific number of vacancies\n", "\n", "# nda_seats_p2 = math.floor((nda_strength_p2 * 100)/droop_quota_p2)\n", "\n", "# upa_seats_p2 = math.floor((upa_strength_p2 * 100)/droop_quota_p2)\n", "\n", "# NDA += nda_seats_p2/vacancies_number_p2 #Do I need to divide by vacancies_number_p here?\n", "\n", "# UPA += upa_seats_p2/vacancies_number_p2 \n", "\n", "# else: #if it is a nominated seat, the 'state' is marked 'nominated' in the data\n", "# if this_date <= rs_seat_retirement_date:\n", "# if alliance == 'NDA':\n", "# NDA += 1\n", "# elif alliance == 'UPA':\n", "# UPA += 1\n", "# #and if there is no alliance affiliation recorded against that MP, do nothing\n", "# #and if the date is after the retirement date, we can't say anything anyway\n", "# if this_date > rs_seat_retirement_date:\n", "# seats_post_retirement += 1\n", "# NOM += 1\n", "\n", " print \"The no. of seats added for NDA is {}.\".format(NDA)\n", " print \"The no. of seats added for UPA is {}.\".format(UPA)\n", " #print NOM\n", " print \"The no. of vacancies is {}.\".format(seats_post_retirement)\n", " print \"The no. of vacancies before assembly end is {}.\".format(seats_post_retirement_before_assembly_end)\n", " #OTHERS = 245 - (NDA + UPA)\n", " #print OTHERS\n", " \n", "# csv_row = list()\n", "# csv_row.append(this_date)\n", "# csv_row.append(NDA)\n", "# csv_row.append(UPA)\n", "# csv_row.append(OTHERS)\n", " \n", " # with open(\"alliances_over_time_realistic.csv\", \"ab\") as filez:\n", " # wrz = csv.writer(filez, delimiter = ',' , quotechar = '\"' )\n", " # wrz.writerow(csv_row)\n", "\n", "#filez.close()\n", "\n", "print \"program done\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }