Skip to content
Snippets Groups Projects
Commit c44d1abd authored by jvfpw18's avatar jvfpw18
Browse files

Fix insertion when two columns are based in the same header

parent 9266139f
No related branches found
No related tags found
2 merge requests!13v1.1.0,!10Fix insertion when two columns are based in the same header
......@@ -74,9 +74,19 @@ class Protocol(object):
if not indexes:
return None
if len(indexes) > 1:
return None
self.resolve_duplicates(year, indexes)
return self._remaped[indexes[0]]
def resolve_duplicates(self, year, indexes):
'''
Transforms a dbcolumn that gets the data from the same header to a denormalization of the first column.
'''
original_dbcolumn = self.dbcolumn_from_target(self._remaped[indexes[0]])[0]
for i in range(1, len(indexes)):
self._dataframe.loc[indexes[i], year] = '~' + original_dbcolumn
def original_from_target(self, name, year):
'''Gets original column from target column and a year
Input example: **{'name': 'CEBMA015N0', 'year': '2015'}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment