Skip to content

Commit

Permalink
Adjust numpy arrays to actual length
Browse files Browse the repository at this point in the history
  • Loading branch information
janssenhenning committed Jan 24, 2022
1 parent 106fb6e commit 3ccf158
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions masci_tools/io/parsers/tabulator/tabulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def tabulate(self,

keypaths: KeyPaths = []

dtypes_set: frozenset[str] = frozenset()
for index, item in enumerate(collection):

# get inc/ex lists. assume that they are in valid keypaths format already
Expand Down Expand Up @@ -269,6 +270,11 @@ def tabulate(self,
dtypes=dtypes_set,
pass_item_to_transformer=pass_item_to_transformer,
**kwargs)
length = index + 1

#Adjust to actual length
for column in dtypes_set:
table[column] = table[column][:length]

if drop_empty_columns:
empty_columns = [colname for colname, values in table.items() if all(v is None for v in values)]
Expand Down

0 comments on commit 3ccf158

Please sign in to comment.