continuing

This commit is contained in:
frankknoll
2023-06-06 23:37:24 +02:00
parent 50659a8b82
commit 3b5412ec37
3 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import pandas as pd
class CountryCountsByBatchcodeTable2BarChartDescriptionTableConverter:
@staticmethod
def convert2BarChartDescriptionTable(countryCountsByBatchcodeTable):
return (countryCountsByBatchcodeTable
.reset_index(level = 'COUNTRY')
.rename(
columns =
{
'COUNTRY': 'countries',
'COUNTRY_COUNT_BY_VAX_LOT Clicked': 'frequencies guessed',
'COUNTRY_COUNT_BY_VAX_LOT Before Deletion': 'frequencies before deletion'
})
.groupby('VAX_LOT')
.apply(CountryCountsByBatchcodeTable2BarChartDescriptionTableConverter._convert2BarChartDescription)
.rename('BAR_CHART_DESCRIPTION')
.to_frame())
@staticmethod
def _convert2BarChartDescription(countryCountsTable):
barChartDescription = countryCountsTable.to_dict('list')
barChartDescription['batchcode'] = countryCountsTable.index.values[0]
return barChartDescription