adding CompletedBatchcodeColumnAdder

This commit is contained in:
frankknoll
2023-03-24 21:01:56 +01:00
parent 6c7a27f258
commit 21a10d4b12
4 changed files with 3690 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import pandas as pd
class CompletedBatchcodeColumnAdder:
def __init__(self, completeBatchcode):
self.completeBatchcode = completeBatchcode
def addCompletedBatchcodeColumn(self, tableByPartialBatchcode):
partialBatchcodeTable = tableByPartialBatchcode.index.to_frame()
partialBatchcodeTable['Completed Batchcode'] = partialBatchcodeTable[tableByPartialBatchcode.index.name].map(self.completeBatchcode)
return tableByPartialBatchcode.set_index(pd.MultiIndex.from_frame(partialBatchcodeTable))