make column naming consistent

This commit is contained in:
iuvbio 2019-06-08 16:37:33 +02:00
parent 78edd09076
commit 3caa7ccaa3
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ def load_ods(doc, sheet_id, headers=True, columns=None):
continue continue
elif i == 0: elif i == 0:
columns = columns if columns else ( columns = columns if columns else (
[f"column_{j}" for j in range(len(row))]) [f"column.{j}" for j in range(len(row))])
# columns as lists in a dictionary # columns as lists in a dictionary
df_dict = OrderedDict((column, []) for column in columns) df_dict = OrderedDict((column, []) for column in columns)
# create index for the column headers # create index for the column headers

View File

@ -43,7 +43,7 @@ class TestOdsReader(object):
path = os.path.join(rsc, no_header_file) path = os.path.join(rsc, no_header_file)
df = read_ods(path, 1, headers=False) df = read_ods(path, 1, headers=False)
assert list(df.columns) == [ assert list(df.columns) == [
f"column_{i}" for i in range(len(df.columns))] f"column.{i}" for i in range(len(df.columns))]
assert len(df) == 10 assert len(df) == 10
assert (len(df.columns) == 5) assert (len(df.columns) == 5)