Closed berinhard closed 4 years ago
I'm not sure if this is really necessary (but I'm open to discuss), since:
_asdict
is part of its API (even if it starts with underscore).row_class=dict
in import_from_csv
(the feature of changing the class is currently possible but with a little hack - please check this comment).Got it @turicas! I feel the suggestion in #30 covers this scenario I've described. So, after #30 being implemented, the following code snippet would work, right?
output_rows = []
for book in rows.import_from_csv(csv_path, row_class=dict):
isbn = get_isbn_from_title(book['title'])
row = book.copy()
row['isbn_13'] = isbn
output_rows.append(row)
@berinhard yes! I've added this code snippet to #30's description as a suggested API.
I'm using rows to parse a CSV, fetch some data from an API and create a new CSV. So, my code is:
I feel I'm violating something by calling
_asdict
internal method, but it's really useful for me since I'm usingrows.import_from_csv
to facilitate me from manipulating and adding data. What do you think about this? Is there a risk on exposing anasdict
behavior the theRow
object?