Storing cvs data for further manipulation using Ruby
Posted
by ischnura
on Stack Overflow
See other posts from Stack Overflow
or by ischnura
Published on 2010-05-20T21:56:22Z
Indexed on
2010/05/20
22:00 UTC
Read the original article
Hit count: 232
I am dealing with a csv file that has some customer information (email, name, address, amount, [shopping_list: item 1, item 2]).
I would like work with the data and produce some labels for printing... as well as to gather some extra information (total amounts, total items 1...)
My main concern is to find the appropriate structure to store the data in ruby for future manipulation. For now I have thought about the following possibilities:
- multidimensional arrays: pretty simple to build, but pretty hard to access the data in a beautiful ruby way.
- hashes: having the email as key, and storing the information in different hashes (one hash for name, another hash for address, another hash for shopping list...)
- (getting the cvs data in to a Database and working with the data from ruby??)
I would really appreciate your advice and guidance!!
© Stack Overflow or respective owner