-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from meddlin/feature/dynamic-column-names
Dynamic column names
- Loading branch information
Showing
3 changed files
with
54 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
def get_row(row: dict[str, str], column_names: list[str]): | ||
data = [] | ||
|
||
for col in column_names: | ||
data.append(row[col]) | ||
|
||
return data | ||
|
||
def get_row_filtered(row: dict[str, str], column_names: list[str], filter_columns: list[str]): | ||
""" """ | ||
|
||
data = [] | ||
for col in column_names: | ||
if col in filter_columns: | ||
data.append(row[col]) | ||
|
||
return data | ||
|
||
def format_filter_cols(filter_cs_list: str): | ||
""" Separate filter columns. | ||
Remove leading and trailiing whitespace from filter columns. | ||
Return as a list. | ||
""" | ||
cols = filter_cs_list.split(',') | ||
cleaned = [] | ||
for col in cols: | ||
cleaned.append(col.strip().replace("'", "")) | ||
|
||
return cleaned |