Commit 7d3ebec4 authored by Enzo Buthiot's avatar Enzo Buthiot

Add commentaries

parent d744aa1f
Pipeline #200387 passed with stages
in 5 minutes and 25 seconds
......@@ -299,6 +299,7 @@ def parse_xlsx_file(data_filepath : Path):
new_date = datetime(*xlrd.xldate_as_tuple(date, workbook.datemode)).strftime("%Y-%m-%d")
list_date.append(new_date)
else:
# Create the series by parsing elements of each column
for element in range(0, len(worksheet.col_values(index))):
if element == 0:
code_serie = worksheet.col_values(index)[element]
......@@ -331,12 +332,15 @@ def parse_xlsx_file_total(data_filepath : Path):
if index == 0:
for element in range(1, len(worksheet.col_values(index))):
date = worksheet.col_values(index)[element]
# If date is in month, convert date and append it to list_date_months
if type(date) == float:
new_date = datetime(*xlrd.xldate_as_tuple(date, workbook.datemode)).strftime("%Y-%m-%d")
list_date_months.append(new_date)
# If date is in quarter just append it to list_date_quarters
elif type(date) == str:
list_date_quarters.append(date)
else:
# Create the series by parsing elements of each column
for element in range(0, len(worksheet.col_values(index))):
if element == 0:
code_serie = worksheet.col_values(index)[element]
......@@ -353,11 +357,13 @@ def parse_xlsx_file_total(data_filepath : Path):
for s in series.items():
if s[0] not in new_series.keys():
new_series[s[0]] = list()
# For monthly information
if len(s[1]) >= 430:
new_list_months = list(zip(list_date_months, s[1]))
for element in new_list_months:
new_series[s[0]].append(element)
new_series[s[0]].insert(0, ("PERIOD", "VALUE"))
# For quarter information
else:
new_list_quarters = list(zip(list_date_quarters, s[1]))
for element in new_list_quarters:
......@@ -382,12 +388,15 @@ def parse_xlsx_file_industry_sa_total(data_filepath : Path):
if index == 0:
for element in range(1, len(worksheet.col_values(index))):
date = worksheet.col_values(index)[element]
# If date is in month, convert date and append it to list_date_months
if type(date) == float:
new_date = datetime(*xlrd.xldate_as_tuple(date, workbook.datemode)).strftime("%Y-%m-%d")
list_date_months.append(new_date)
# If date is in quarter just append it to list_date_quarters
elif type(date) == str:
list_date_quarters.append(date)
else:
# Create the series by parsing elements of each column
for element in range(0, len(worksheet.col_values(index))):
if element == 0:
code_serie = worksheet.col_values(index)[element]
......@@ -404,12 +413,14 @@ def parse_xlsx_file_industry_sa_total(data_filepath : Path):
for s in series.items():
if s[0] not in new_series.keys():
new_series[s[0]] = list()
# For monthly information
if len(s[1]) >= 430:
new_list_months = list(zip(list_date_months, s[1]))
for element in new_list_months:
new_series[s[0]].append(element)
new_series[s[0]].insert(0, ("PERIOD", "VALUE"))
else:
# For quarter information
new_list_quarters = list(zip(list_date_quarters, s[1]))
for element in new_list_quarters:
new_series[s[0]].append(element)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment