Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
chimet-scraper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SERG
chimet-scraper
Commits
4d38c5bf
Commit
4d38c5bf
authored
6 years ago
by
Alois Klink
Browse files
Options
Downloads
Patches
Plain Diff
Make sure column names are all uppercase
Before, the CSV files jumped to using DATE as a column to using Date.
parent
2fabcfc5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
chimet-scraper.py
+16
-1
16 additions, 1 deletion
chimet-scraper.py
with
16 additions
and
1 deletion
chimet-scraper.py
+
16
−
1
View file @
4d38c5bf
...
@@ -182,6 +182,20 @@ def daterange(from_time, to_time) -> typing.List[datetime.datetime]:
...
@@ -182,6 +182,20 @@ def daterange(from_time, to_time) -> typing.List[datetime.datetime]:
return
dates
return
dates
def
uppercase_columns
(
pandas_dataset
):
"""
Makes sure all the column names are uppercase
Arguments:
pandas_dataset:
The dataset to uppercase column names of.
Warning, this modifies this object.
Returns:
The dataset with uppercase column names.
"""
pandas_dataset
.
columns
=
pandas_dataset
.
columns
.
str
.
upper
()
return
pandas_dataset
def
combine_csvs
(
input_csv_files
:
list
,
output_loc
):
def
combine_csvs
(
input_csv_files
:
list
,
output_loc
):
"""
Combines the given csv files into one big one.
"""
Combines the given csv files into one big one.
...
@@ -191,7 +205,8 @@ def combine_csvs(input_csv_files: list, output_loc):
...
@@ -191,7 +205,8 @@ def combine_csvs(input_csv_files: list, output_loc):
input_csv_files: The list of csv files to combine.
input_csv_files: The list of csv files to combine.
output_loc: Where the save the combined csv file.
output_loc: Where the save the combined csv file.
"""
"""
combined
=
pd
.
concat
([
pd
.
read_csv
(
f
)
for
f
in
input_csv_files
])
combined
=
pd
.
concat
([
uppercase_columns
(
pd
.
read_csv
(
f
))
for
f
in
input_csv_files
])
combined
.
to_csv
(
output_loc
,
index
=
False
,
encoding
=
'
utf-8
'
)
combined
.
to_csv
(
output_loc
,
index
=
False
,
encoding
=
'
utf-8
'
)
def
make_csv
(
location
:
Locations
,
def
make_csv
(
location
:
Locations
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment