Skip to content

Commit

Permalink
Merge pull request #128 from vreuter/tables
Browse files Browse the repository at this point in the history
Enumerate rows for int-based indexing
  • Loading branch information
vreuter committed Jun 12, 2017
2 parents 70fd1e6 + 0c8ec84 commit 1944c0f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions looper/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,27 @@ def add_sample_sheet(self, csv=None):
# so we don't re-derive them later.
merged_cols = {
key: "" for key in merge_rows.columns}
for row in merge_rows.index:
for row in range(len(merge_rows.index)):
_LOGGER.debug(
"New row: {}, {}".format(row, merge_rows))

# Update with derived columns
row_dict = merge_rows.iloc[row].to_dict()
try:
row_dict = merge_rows.iloc[row].to_dict()
except IndexError:
context = "Processing of sample {} " \
"attempted to access row {} in " \
"table with shape {}".\
format(sample.name, row,
merge_rows.shape)
_LOGGER.error(context)
_LOGGER.error("Columns: {}".
format(merge_table.columns))
_LOGGER.error("Full rows = {}, "
"reduced rows = {}".format(
merge_table.index, merge_rows.index))
raise

for col in merge_rows.columns:
if col == SAMPLE_NAME_COLNAME or \
col not in self.derived_columns:
Expand Down

0 comments on commit 1944c0f

Please sign in to comment.