refactoring
This commit is contained in:
@@ -4,30 +4,32 @@ class CountryCountsByClickedBatchcodeProvider:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getCountryCountsByClickedBatchcode(file):
|
def getCountryCountsByClickedBatchcode(file):
|
||||||
exploration = pd.read_csv(file, index_col = 0, skiprows = [0, 1, 2, 3, 4, 5, 7])
|
return CountryCountsByClickedBatchcodeProvider._read_csv(
|
||||||
exploration.index.name = 'VAX_LOT'
|
file = file,
|
||||||
exploration.rename(
|
columns = {
|
||||||
columns =
|
|
||||||
{
|
|
||||||
'Country': 'COUNTRY',
|
'Country': 'COUNTRY',
|
||||||
'Event count': 'COUNTRY_COUNT_BY_VAX_LOT'
|
'Event count': 'COUNTRY_COUNT_BY_VAX_LOT'
|
||||||
},
|
},
|
||||||
inplace = True)
|
index_columns = ['COUNTRY'])
|
||||||
exploration.set_index('COUNTRY', append = True, inplace = True)
|
|
||||||
return exploration
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getCityCountsByClickedBatchcode(file):
|
def getCityCountsByClickedBatchcode(file):
|
||||||
exploration = pd.read_csv(file, index_col = 0, skiprows = [0, 1, 2, 3, 4, 5, 7])
|
return CountryCountsByClickedBatchcodeProvider._read_csv(
|
||||||
exploration.index.name = 'VAX_LOT'
|
file = file,
|
||||||
exploration.rename(
|
columns = {
|
||||||
columns =
|
|
||||||
{
|
|
||||||
'Country': 'COUNTRY',
|
'Country': 'COUNTRY',
|
||||||
'Region': 'REGION',
|
'Region': 'REGION',
|
||||||
'City': 'CITY',
|
'City': 'CITY',
|
||||||
'Event count': 'CITY_COUNT_BY_VAX_LOT'
|
'Event count': 'CITY_COUNT_BY_VAX_LOT'
|
||||||
},
|
},
|
||||||
|
index_columns = ['COUNTRY', 'REGION', 'CITY'])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _read_csv(file, columns, index_columns):
|
||||||
|
exploration = pd.read_csv(file, index_col = 0, skiprows = [0, 1, 2, 3, 4, 5, 7])
|
||||||
|
exploration.index.name = 'VAX_LOT'
|
||||||
|
exploration.rename(
|
||||||
|
columns = columns,
|
||||||
inplace = True)
|
inplace = True)
|
||||||
exploration.set_index(['COUNTRY', 'REGION', 'CITY'], append = True, inplace = True)
|
exploration.set_index(index_columns, append = True, inplace = True)
|
||||||
return exploration
|
return exploration
|
||||||
|
|||||||
Reference in New Issue
Block a user