Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csvlink with different columns #86

Open
joernhees opened this issue May 19, 2018 · 0 comments
Open

csvlink with different columns #86

joernhees opened this issue May 19, 2018 · 0 comments

Comments

@joernhees
Copy link
Contributor

I have a use-case for csvlink with two files containing different amounts of columns. There is no clear 1:1 mapping of colX from file1 to colY from file2.

Looking at the code i don't understand what the intention of this is:

if self.field_names_1 != self.field_names_2:
for record_id, record in data_2.items():
remapped_record = {}
for new_field, old_field in zip(self.field_names_1,
self.field_names_2):
remapped_record[new_field] = record[old_field]
data_2[record_id] = remapped_record

It looks as if data_2 records are re-written pairwise into the field names of file 1... if the field names have different lengths things are dropped. Is that meant to happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant