From 361c5a97f2c5784972a91106bf6076d62642cbd6 Mon Sep 17 00:00:00 2001 From: frankknoll Date: Mon, 1 May 2023 15:00:26 +0200 Subject: [PATCH] getCountryCountsByBatchcodeTable() --- src/CountriesByBatchcodeProvider.py | 65 +- src/HowBadIsMyBatch.ipynb | 1051 +-------------------------- 2 files changed, 44 insertions(+), 1072 deletions(-) diff --git a/src/CountriesByBatchcodeProvider.py b/src/CountriesByBatchcodeProvider.py index 4b41282348b..81e0f26a0cd 100644 --- a/src/CountriesByBatchcodeProvider.py +++ b/src/CountriesByBatchcodeProvider.py @@ -1,39 +1,50 @@ import pandas as pd -from CompletedBatchcodeColumnAdder import CompletedBatchcodeColumnAdder -from BatchcodeCompletion import BatchcodeCompletion -from CountriesColumnAdder import CountriesColumnAdder from BatchCodeTableFactory import BatchCodeTableFactory from InternationalVaersCovid19Provider import getInternationalVaersCovid19 -def getCountriesByCompletedBatchcode(internationalVaersCovid19): - result = _readExploration('data/Country By Batchcode Search Term.csv', indexName = 'Batchcode Search Term') - result = _addCompletedBatchcodeColumn(result, internationalVaersCovid19) - columnName = 'Countries' - result = CountriesColumnAdder().addCountriesColumn(result, columnName = columnName) - return result[[columnName]].droplevel('Batchcode Search Term') -def _addCompletedBatchcodeColumn(country_By_Batchcode_Search_Term, internationalVaersCovid19): - return CompletedBatchcodeColumnAdder(_getCompleteBatchcode(internationalVaersCovid19)).addCompletedBatchcodeColumn(country_By_Batchcode_Search_Term) +def getCountryCountsByBatchcodeTable(): + return _combineCountryCountsByBatchcodeTables( + countryCountsByClickedBatchcode = _getCountryCountsByClickedBatchcode(), + countryCountsByBatchcodeBeforeDeletion = _getCountryCountsByBatchcodeBeforeDeletion()) -def _getCompleteBatchcode(internationalVaersCovid19): - batchCodeTable = BatchCodeTableFactory(internationalVaersCovid19).createGlobalBatchCodeTable() - return BatchcodeCompletion(ADR_by_Batchcode = batchCodeTable).completeBatchcode - -def getCountriesByClickedBatchcode(): - result = _readExploration('data/Country By Clicked Batchcode.csv', indexName = 'Clicked Batchcode') - columnName = 'Countries' - result = CountriesColumnAdder().addCountriesColumn(result, columnName = columnName) - return result[[columnName]] -def _readExploration(csvFile, indexName): - exploration = pd.read_csv(csvFile, header = [0], index_col = 0, skiprows = 6, on_bad_lines = 'warn') - exploration.drop(index=indexName, inplace=True) - exploration.index.rename(indexName, inplace=True) - exploration.drop(columns='Totals', inplace=True) - for column in exploration.columns: - exploration[column] = exploration[column].astype('int64') +def _getCountryCountsByClickedBatchcode(): + exploration = pd.read_csv('data/Country By Clicked Batchcode.csv', index_col = 0, skiprows = [0, 1, 2, 3, 4, 5, 7]) + exploration.index.name = 'VAX_LOT' + exploration.rename( + columns = + { + 'Country': 'COUNTRY', + 'Event count': 'COUNTRY_COUNT_BY_VAX_LOT' + }, + inplace = True) + exploration.set_index('COUNTRY', append = True, inplace = True) return exploration + +def _getCountryCountsByBatchcodeBeforeDeletion(): + internationalVaersCovid19 = getInternationalVaersCovid19(dataDir = 'VAERS/VAERSBeforeDeletion', years = [2020, 2021, 2022]) + return (internationalVaersCovid19 + .groupby('VAX_LOT') + ['COUNTRY'].value_counts() + .to_frame(name = 'COUNTRY_COUNT_BY_VAX_LOT')) + + +def _combineCountryCountsByBatchcodeTables(countryCountsByClickedBatchcode, countryCountsByBatchcodeBeforeDeletion): + countryCountsByBatchcode = pd.merge( + countryCountsByClickedBatchcode, + countryCountsByBatchcodeBeforeDeletion, + how = 'outer', + left_index = True, + right_index = True, + suffixes=(' Clicked', ' Before Deletion')) + countryCountsByBatchcode.fillna(0, inplace = True) + for column in countryCountsByBatchcode.columns: + countryCountsByBatchcode[column] = countryCountsByBatchcode[column].astype('int64') + return countryCountsByBatchcode + + def getCountriesByBatchcodeBeforeDeletion(): internationalVaersCovid19 = getInternationalVaersCovid19(dataDir = 'VAERS/VAERSBeforeDeletion', years = [2020, 2021, 2022]) batchCodeTable = BatchCodeTableFactory(internationalVaersCovid19).createGlobalBatchCodeTable(countriesAsList = True) diff --git a/src/HowBadIsMyBatch.ipynb b/src/HowBadIsMyBatch.ipynb index 0c5244e27df..ea00af3157c 100644 --- a/src/HowBadIsMyBatch.ipynb +++ b/src/HowBadIsMyBatch.ipynb @@ -15,14 +15,14 @@ "import os\n", "from VAERSFileDownloader import updateVAERSFiles\n", "from datetime import datetime\n", - "from DateProvider import DateProvider\n", "from InternationalVaersCovid19Provider import getInternationalVaersCovid19, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n", "from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile\n", "from BatchCodeTablePersister import createAndSaveBatchCodeTables\n", "from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n", "from HistogramFactoryAndPersister import createAndSaveGlobalHistograms, createAndSaveHistogramsForCountries\n", "from BatchCodeTableFactory import BatchCodeTableFactory\n", - "from BatchCodeTableHavingGuessedCountriesFactory import BatchCodeTableHavingGuessedCountriesFactory\n" + "from BatchCodeTableHavingGuessedCountriesFactory import BatchCodeTableHavingGuessedCountriesFactory\n", + "from CountriesByBatchcodeProvider import getCountryCountsByBatchcodeTable\n" ] }, { @@ -35,20 +35,6 @@ "print(datetime.now().strftime(\"%d.%m.%Y, %H:%M:%S Uhr\"))" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ffad1c04", - "metadata": {}, - "outputs": [], - "source": [ - "dateProvider = DateProvider()\n", - "print(' lastUpdated:', dateProvider.getLastUpdated())\n", - "print('lastUpdatedDataSource:', dateProvider.getLastUpdatedDataSource())\n", - "needsUpdate = dateProvider.needsUpdate()\n", - "print('needsUpdate:', needsUpdate)" - ] - }, { "cell_type": "code", "execution_count": null, @@ -169,1038 +155,13 @@ }, { "cell_type": "code", - "execution_count": 6, - "id": "dc8fa52b", + "execution_count": null, + "id": "d6c2b650", "metadata": {}, "outputs": [], "source": [ - "import pandas as pd\n", - "from CountriesByBatchcodeProvider import getCountriesByClickedBatchcode, getCountriesByBatchcodeBeforeDeletion" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "b01a5f94", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "b'Skipping line 9: expected 22 fields, saw 23\\n'\n" - ] - }, - { - "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", - "
Countries
Clicked Batchcode
(not set){Germany, Poland, United Kingdom, Australia, B...
FE6208{Germany, Poland, United Kingdom, Australia, B...
039K20A{Sweden, United States, Spain, France, Austral...
EN6201{Sweden, United States, Spain, France, Austral...
FD6840{Sweden, United States, Spain, France, Austral...
......
ZTC540693{United States}
ZU5A21A{}
ZZ3249{Hungary}
026L20A{United States}
ÂK4244{Hungary}
\n", - "

5392 rows × 1 columns

\n", - "
" - ], - "text/plain": [ - " Countries\n", - "Clicked Batchcode \n", - "(not set) {Germany, Poland, United Kingdom, Australia, B...\n", - "FE6208 {Germany, Poland, United Kingdom, Australia, B...\n", - "039K20A {Sweden, United States, Spain, France, Austral...\n", - "EN6201 {Sweden, United States, Spain, France, Austral...\n", - "FD6840 {Sweden, United States, Spain, France, Austral...\n", - "... ...\n", - "ZTC540693 {United States}\n", - "ZU5A21A {}\n", - "ZZ3249 {Hungary}\n", - "  026L20A {United States}\n", - "ÂK4244 {Hungary}\n", - "\n", - "[5392 rows x 1 columns]" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "countriesByClickedBatchcode = getCountriesByClickedBatchcode()\n", - "countriesByClickedBatchcode" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "521ee957", - "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", - "
Countries
VAX_LOT
6362737[United States]
SCH2[United States]
NO72A[Philippines]
EW096[United States]
FS1926[United States]
......
211221A[United States]
2112D21A[United States]
2114214[United States]
211421A[United States]
Ø94F21A[Norway]
\n", - "

47901 rows × 1 columns

\n", - "
" - ], - "text/plain": [ - " Countries\n", - "VAX_LOT \n", - "6362737 [United States]\n", - "SCH2 [United States]\n", - "NO72A [Philippines]\n", - "EW096 [United States]\n", - "FS1926 [United States]\n", - "... ...\n", - "211221A [United States]\n", - "2112D21A [United States]\n", - "2114214 [United States]\n", - "211421A [United States]\n", - "Ø94F21A [Norway]\n", - "\n", - "[47901 rows x 1 columns]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "countriesByBatchcodeBeforeDeletion = getCountriesByBatchcodeBeforeDeletion()\n", - "countriesByBatchcodeBeforeDeletion" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "id": "c91d1b4d", - "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", - "
Countries ClickedCountries Before Deletion
VAX_LOT
FE6208{Germany, Poland, United Kingdom, Australia, B...[Austria, Croatia, Czechia, Germany, Greece, H...
039K20A{Sweden, United States, Spain, France, Austral...[United States]
EN6201{Sweden, United States, Spain, France, Austral...[United Kingdom, United States]
FD6840{Sweden, United States, Spain, France, Austral...[Austria, Croatia, Cyprus, Czechia, Germany, G...
FF0680{Sweden, United States, Canada, Brazil, German...[Austria, Croatia, Czechia, Finland, France, G...
.........
ZTC540693{United States}[United States]
ZU5A21A{}[United States]
ZZ3249{Hungary}[United States]
026L20A{United States}[United States]
ÂK4244{Hungary}[United Kingdom]
\n", - "

5188 rows × 2 columns

\n", - "
" - ], - "text/plain": [ - " Countries Clicked \\\n", - "VAX_LOT \n", - "FE6208 {Germany, Poland, United Kingdom, Australia, B... \n", - "039K20A {Sweden, United States, Spain, France, Austral... \n", - "EN6201 {Sweden, United States, Spain, France, Austral... \n", - "FD6840 {Sweden, United States, Spain, France, Austral... \n", - "FF0680 {Sweden, United States, Canada, Brazil, German... \n", - "... ... \n", - "ZTC540693 {United States} \n", - "ZU5A21A {} \n", - "ZZ3249 {Hungary} \n", - "  026L20A {United States} \n", - "ÂK4244 {Hungary} \n", - "\n", - " Countries Before Deletion \n", - "VAX_LOT \n", - "FE6208 [Austria, Croatia, Czechia, Germany, Greece, H... \n", - "039K20A [United States] \n", - "EN6201 [United Kingdom, United States] \n", - "FD6840 [Austria, Croatia, Cyprus, Czechia, Germany, G... \n", - "FF0680 [Austria, Croatia, Czechia, Finland, France, G... \n", - "... ... \n", - "ZTC540693 [United States] \n", - "ZU5A21A [United States] \n", - "ZZ3249 [United States] \n", - "  026L20A [United States] \n", - "ÂK4244 [United Kingdom] \n", - "\n", - "[5188 rows x 2 columns]" - ] - }, - "execution_count": 41, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = pd.merge(\n", - " countriesByClickedBatchcode,\n", - " countriesByBatchcodeBeforeDeletion,\n", - " how = 'inner',\n", - " left_index = True,\n", - " right_index = True,\n", - " suffixes=(' Clicked', ' Before Deletion'))\n", - "res.index.name = 'VAX_LOT'\n", - "res" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "id": "df6e5ef1", - "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", - "
Countries ClickedCountries Before Deletion
VAX_LOT
FE6208{Germany, Poland, United Kingdom, Australia, B...{Lithuania, Spain, Czechia, Greece, Germany, A...
039K20A{Sweden, United States, Spain, France, Austral...{United States}
EN6201{Sweden, United States, Spain, France, Austral...{United Kingdom, United States}
FD6840{Sweden, United States, Spain, France, Austral...{Lithuania, Cyprus, Czechia, Greece, Germany, ...
FF0680{Sweden, United States, Canada, Brazil, German...{Portugal, Sweden, Czechia, France, Finland, G...
.........
ZTC540693{United States}{United States}
ZU5A21A{}{United States}
ZZ3249{Hungary}{United States}
026L20A{United States}{United States}
ÂK4244{Hungary}{United Kingdom}
\n", - "

5188 rows × 2 columns

\n", - "
" - ], - "text/plain": [ - " Countries Clicked \\\n", - "VAX_LOT \n", - "FE6208 {Germany, Poland, United Kingdom, Australia, B... \n", - "039K20A {Sweden, United States, Spain, France, Austral... \n", - "EN6201 {Sweden, United States, Spain, France, Austral... \n", - "FD6840 {Sweden, United States, Spain, France, Austral... \n", - "FF0680 {Sweden, United States, Canada, Brazil, German... \n", - "... ... \n", - "ZTC540693 {United States} \n", - "ZU5A21A {} \n", - "ZZ3249 {Hungary} \n", - "  026L20A {United States} \n", - "ÂK4244 {Hungary} \n", - "\n", - " Countries Before Deletion \n", - "VAX_LOT \n", - "FE6208 {Lithuania, Spain, Czechia, Greece, Germany, A... \n", - "039K20A {United States} \n", - "EN6201 {United Kingdom, United States} \n", - "FD6840 {Lithuania, Cyprus, Czechia, Greece, Germany, ... \n", - "FF0680 {Portugal, Sweden, Czechia, France, Finland, G... \n", - "... ... \n", - "ZTC540693 {United States} \n", - "ZU5A21A {United States} \n", - "ZZ3249 {United States} \n", - "  026L20A {United States} \n", - "ÂK4244 {United Kingdom} \n", - "\n", - "[5188 rows x 2 columns]" - ] - }, - "execution_count": 42, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res['Countries Before Deletion'] = res['Countries Before Deletion'].map(set)\n", - "res" - ] - }, - { - "cell_type": "code", - "execution_count": 43, - "id": "62d68836", - "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", - "
Countries ClickedCountries Before DeletionCountries Intersection
VAX_LOT
FE6208{Germany, Poland, United Kingdom, Australia, B...{Lithuania, Spain, Czechia, Greece, Germany, A...[Austria, Germany, Hungary, Spain, Sweden, Uni...
039K20A{Sweden, United States, Spain, France, Austral...{United States}[United States]
EN6201{Sweden, United States, Spain, France, Austral...{United Kingdom, United States}[United Kingdom, United States]
FD6840{Sweden, United States, Spain, France, Austral...{Lithuania, Cyprus, Czechia, Greece, Germany, ...[Austria, Germany, Hungary, Sweden, United Kin...
FF0680{Sweden, United States, Canada, Brazil, German...{Portugal, Sweden, Czechia, France, Finland, G...[Austria, Germany, Hungary, Italy, Netherlands...
............
ZTC540693{United States}{United States}[United States]
ZU5A21A{}{United States}[]
ZZ3249{Hungary}{United States}[]
026L20A{United States}{United States}[United States]
ÂK4244{Hungary}{United Kingdom}[]
\n", - "

5188 rows × 3 columns

\n", - "
" - ], - "text/plain": [ - " Countries Clicked \\\n", - "VAX_LOT \n", - "FE6208 {Germany, Poland, United Kingdom, Australia, B... \n", - "039K20A {Sweden, United States, Spain, France, Austral... \n", - "EN6201 {Sweden, United States, Spain, France, Austral... \n", - "FD6840 {Sweden, United States, Spain, France, Austral... \n", - "FF0680 {Sweden, United States, Canada, Brazil, German... \n", - "... ... \n", - "ZTC540693 {United States} \n", - "ZU5A21A {} \n", - "ZZ3249 {Hungary} \n", - "  026L20A {United States} \n", - "ÂK4244 {Hungary} \n", - "\n", - " Countries Before Deletion \\\n", - "VAX_LOT \n", - "FE6208 {Lithuania, Spain, Czechia, Greece, Germany, A... \n", - "039K20A {United States} \n", - "EN6201 {United Kingdom, United States} \n", - "FD6840 {Lithuania, Cyprus, Czechia, Greece, Germany, ... \n", - "FF0680 {Portugal, Sweden, Czechia, France, Finland, G... \n", - "... ... \n", - "ZTC540693 {United States} \n", - "ZU5A21A {United States} \n", - "ZZ3249 {United States} \n", - "  026L20A {United States} \n", - "ÂK4244 {United Kingdom} \n", - "\n", - " Countries Intersection \n", - "VAX_LOT \n", - "FE6208 [Austria, Germany, Hungary, Spain, Sweden, Uni... \n", - "039K20A [United States] \n", - "EN6201 [United Kingdom, United States] \n", - "FD6840 [Austria, Germany, Hungary, Sweden, United Kin... \n", - "FF0680 [Austria, Germany, Hungary, Italy, Netherlands... \n", - "... ... \n", - "ZTC540693 [United States] \n", - "ZU5A21A [] \n", - "ZZ3249 [] \n", - "  026L20A [United States] \n", - "ÂK4244 [] \n", - "\n", - "[5188 rows x 3 columns]" - ] - }, - "execution_count": 43, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "def intersect(series):\n", - " return sorted(set.intersection(*series))\n", - "\n", - "res['Countries Intersection'] = res.apply(intersect, axis = 'columns')\n", - "res" - ] - }, - { - "cell_type": "code", - "execution_count": 46, - "id": "a700cb34", - "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", - "
Countries ClickedCountries Before DeletionCountries Intersection
VAX_LOT
FH3253{Australia, Malaysia}{Austria, Switzerland, Belgium}[]
FE2090{United Kingdom, Australia, Germany}{Estonia, Spain, France, Denmark, South Africa...[]
FF0884{Australia, Malaysia, Japan}{Ireland, Denmark}[]
FG2872{Malaysia, Brazil}{Georgia, United States, Israel}[]
FG3716{Australia, Italy, Malaysia}{Estonia, Spain, France, Norway, Austria, Denm...[]
............
YFL8095{Japan}{United States}[]
Z07AZ1A{Brazil}{United States}[]
ZU5A21A{}{United States}[]
ZZ3249{Hungary}{United States}[]
ÂK4244{Hungary}{United Kingdom}[]
\n", - "

1345 rows × 3 columns

\n", - "
" - ], - "text/plain": [ - " Countries Clicked \\\n", - "VAX_LOT \n", - "FH3253 {Australia, Malaysia} \n", - "FE2090 {United Kingdom, Australia, Germany} \n", - "FF0884 {Australia, Malaysia, Japan} \n", - "FG2872 {Malaysia, Brazil} \n", - "FG3716 {Australia, Italy, Malaysia} \n", - "... ... \n", - "YFL8095 {Japan} \n", - "Z07AZ1A {Brazil} \n", - "ZU5A21A {} \n", - "ZZ3249 {Hungary} \n", - "ÂK4244 {Hungary} \n", - "\n", - " Countries Before Deletion \\\n", - "VAX_LOT \n", - "FH3253 {Austria, Switzerland, Belgium} \n", - "FE2090 {Estonia, Spain, France, Denmark, South Africa... \n", - "FF0884 {Ireland, Denmark} \n", - "FG2872 {Georgia, United States, Israel} \n", - "FG3716 {Estonia, Spain, France, Norway, Austria, Denm... \n", - "... ... \n", - "YFL8095 {United States} \n", - "Z07AZ1A {United States} \n", - "ZU5A21A {United States} \n", - "ZZ3249 {United States} \n", - "ÂK4244 {United Kingdom} \n", - "\n", - " Countries Intersection \n", - "VAX_LOT \n", - "FH3253 [] \n", - "FE2090 [] \n", - "FF0884 [] \n", - "FG2872 [] \n", - "FG3716 [] \n", - "... ... \n", - "YFL8095 [] \n", - "Z07AZ1A [] \n", - "ZU5A21A [] \n", - "ZZ3249 [] \n", - "ÂK4244 [] \n", - "\n", - "[1345 rows x 3 columns]" - ] - }, - "execution_count": 46, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res[res['Countries Intersection'].apply(lambda s: len(s) == 0)]" - ] - }, - { - "cell_type": "code", - "execution_count": 50, - "id": "8fcb32f0", - "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", - "
Countries ClickedCountries Before DeletionCountries Intersection
VAX_LOT
FE6208{Germany, Poland, United Kingdom, Australia, B...{Lithuania, Spain, Czechia, Greece, Germany, A...[Austria, Germany, Hungary, Spain, Sweden, Uni...
039K20A{Sweden, United States, Spain, France, Austral...{United States}[United States]
EN6201{Sweden, United States, Spain, France, Austral...{United Kingdom, United States}[United Kingdom, United States]
FD6840{Sweden, United States, Spain, France, Austral...{Lithuania, Cyprus, Czechia, Greece, Germany, ...[Austria, Germany, Hungary, Sweden, United Kin...
FF0680{Sweden, United States, Canada, Brazil, German...{Portugal, Sweden, Czechia, France, Finland, G...[Austria, Germany, Hungary, Italy, Netherlands...
............
XXXXXX{United States}{United States}[United States]
XYZ98765{Germany}{Germany}[Germany]
Z01AZ1A{United States}{United States}[United States]
ZTC540693{United States}{United States}[United States]
026L20A{United States}{United States}[United States]
\n", - "

3843 rows × 3 columns

\n", - "
" - ], - "text/plain": [ - " Countries Clicked \\\n", - "VAX_LOT \n", - "FE6208 {Germany, Poland, United Kingdom, Australia, B... \n", - "039K20A {Sweden, United States, Spain, France, Austral... \n", - "EN6201 {Sweden, United States, Spain, France, Austral... \n", - "FD6840 {Sweden, United States, Spain, France, Austral... \n", - "FF0680 {Sweden, United States, Canada, Brazil, German... \n", - "... ... \n", - "XXXXXX {United States} \n", - "XYZ98765 {Germany} \n", - "Z01AZ1A {United States} \n", - "ZTC540693 {United States} \n", - "  026L20A {United States} \n", - "\n", - " Countries Before Deletion \\\n", - "VAX_LOT \n", - "FE6208 {Lithuania, Spain, Czechia, Greece, Germany, A... \n", - "039K20A {United States} \n", - "EN6201 {United Kingdom, United States} \n", - "FD6840 {Lithuania, Cyprus, Czechia, Greece, Germany, ... \n", - "FF0680 {Portugal, Sweden, Czechia, France, Finland, G... \n", - "... ... \n", - "XXXXXX {United States} \n", - "XYZ98765 {Germany} \n", - "Z01AZ1A {United States} \n", - "ZTC540693 {United States} \n", - "  026L20A {United States} \n", - "\n", - " Countries Intersection \n", - "VAX_LOT \n", - "FE6208 [Austria, Germany, Hungary, Spain, Sweden, Uni... \n", - "039K20A [United States] \n", - "EN6201 [United Kingdom, United States] \n", - "FD6840 [Austria, Germany, Hungary, Sweden, United Kin... \n", - "FF0680 [Austria, Germany, Hungary, Italy, Netherlands... \n", - "... ... \n", - "XXXXXX [United States] \n", - "XYZ98765 [Germany] \n", - "Z01AZ1A [United States] \n", - "ZTC540693 [United States] \n", - "  026L20A [United States] \n", - "\n", - "[3843 rows x 3 columns]" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res[res['Countries Intersection'].apply(lambda s: len(s) != 0)]" - ] - }, - { - "cell_type": "code", - "execution_count": 44, - "id": "7750d699", - "metadata": {}, - "outputs": [], - "source": [ - "res.to_excel('tmp/res.xlsx')" + "countryCountsByBatchcode = getCountryCountsByBatchcodeTable()\n", + "countryCountsByBatchcode" ] } ],