refactoring
This commit is contained in:
13
src/GoogleAnalytics/GoogleAnalyticsReader.py
Normal file
13
src/GoogleAnalytics/GoogleAnalyticsReader.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import pandas as pd
|
||||
|
||||
class GoogleAnalyticsReader:
|
||||
|
||||
@staticmethod
|
||||
def read_csv(file, columns, index_columns):
|
||||
dataframe = pd.read_csv(file, index_col = 0, skiprows = [0, 1, 2, 3, 4, 5, 7])
|
||||
dataframe.index.name = 'VAX_LOT'
|
||||
dataframe.rename(
|
||||
columns = columns,
|
||||
inplace = True)
|
||||
dataframe.set_index(index_columns, append = True, inplace = True)
|
||||
return dataframe
|
||||
@@ -1,6 +1,5 @@
|
||||
import pandas as pd
|
||||
from GoogleAnalytics.ResolutionProvider import Resolution, ResolutionProvider
|
||||
from CountryCountsByClickedBatchcodeProvider import CountryCountsByClickedBatchcodeProvider
|
||||
from GoogleAnalytics.GoogleAnalyticsReader import GoogleAnalyticsReader
|
||||
|
||||
class RegionCountsByClickedBatchcodeProvider:
|
||||
|
||||
@@ -17,7 +16,7 @@ class RegionCountsByClickedBatchcodeProvider:
|
||||
# FK-TODO: delegate same method CountryCountsByClickedBatchcodeProvider._getCityCountsByClickedBatchcode() to here
|
||||
@staticmethod
|
||||
def _getCityCountsByClickedBatchcode(file):
|
||||
return CountryCountsByClickedBatchcodeProvider._read_csv(
|
||||
return GoogleAnalyticsReader.read_csv(
|
||||
file = file,
|
||||
columns = {
|
||||
'Country': 'COUNTRY',
|
||||
|
||||
Reference in New Issue
Block a user