-
-
Save cosmic-cortex/520d29c26a01a9a47a1c115f545049a6 to your computer and use it in GitHub Desktop.
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
def _columns_in_table(table: Set[Record]) -> set: | |
return set.union(*[set(record.keys()) for record in table]) | |
def rename(table: Set[Record], columns: dict) -> Set[Record]: | |
table_columns = _columns_in_table(table) | |
table_out = { | |
Record({columns.get(old_name, old_name): record[old_name] for old_name in table_columns}) | |
for record in table | |
} | |
return table_out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment