refactoring

This commit is contained in:
frankknoll
2023-02-06 12:31:20 +01:00
parent 8e311dfa03
commit c3ad15a24c
2 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import pandas as pd import pandas as pd
import numpy as np import numpy as np
from Utils import fillLsts
class SymptomByBatchcodeTableFactory: class SymptomByBatchcodeTableFactory:
@@ -73,9 +74,3 @@ class SymptomByBatchcodeTableFactory:
.dropna() .dropna()
.to_frame(name = symptomColumn) .to_frame(name = symptomColumn)
.reset_index()) .reset_index())
def fillLsts(lsts, desiredLen, fillValue):
return [fillLst(lst, desiredLen, fillValue) for lst in lsts]
def fillLst(lst, desiredLen, fillValue):
return lst + [fillValue] * (max(desiredLen - len(lst), 0))

6
src/Utils.py Normal file
View File

@@ -0,0 +1,6 @@
def fillLsts(lsts, desiredLen, fillValue):
return [fillLst(lst, desiredLen, fillValue) for lst in lsts]
def fillLst(lst, desiredLen, fillValue):
return lst + [fillValue] * (max(desiredLen - len(lst), 0))