Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EC-fetcher
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dbnomics-fetchers
EC-fetcher
Commits
7d3ebec4
Commit
7d3ebec4
authored
Nov 27, 2020
by
Enzo Buthiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add commentaries
parent
d744aa1f
Pipeline
#200387
passed with stages
in 5 minutes and 25 seconds
Changes
1
Pipelines
13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
convert.py
convert.py
+11
-0
No files found.
convert.py
View file @
7d3ebec4
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment