hello
Here is a extract of csv file that i use
Ticker,Trade,Date,Price
FLWS,Long,01/08/2007 2:00:00 PM,9.05
It will always have only 2 rows. How can i load it as a hash so that i
get access it like
hashvar["Ticker"] .....
It there an existing api or do i have to load it as csv and then looop
thro the array and create the hash.
data = FCSV.parse(csv, :headers => true)[0].to_hash
p data
# >> {"Trade"=>"Long", "Date"=>"01/08/2007 2:00:00 PM", "Price"=>"9.05", "Ticker"=>"FLWS"}
__END__
Hope that helps.
James Edward Gray II
···
On Nov 28, 2007, at 12:55 PM, Junkone wrote:
hello
Here is a extract of csv file that i use
Ticker,Trade,Date,Price
FLWS,Long,01/08/2007 2:00:00 PM,9.05
It will always have only 2 rows. How can i load it as a hash so that i
get access it like
hashvar["Ticker"] .....
It there an existing api or do i have to load it as csv and then looop
thro the array and create the hash.
On Nov 28, 2007 1:55 PM, Junkone <junkone1@gmail.com> wrote:
hello
Here is a extract of csv file that i use
Ticker,Trade,Date,Price
FLWS,Long,01/08/2007 2:00:00 PM,9.05
It will always have only 2 rows. How can i load it as a hash so that i
get access it like
hashvar["Ticker"] .....
It there an existing api or do i have to load it as csv and then looop
thro the array and create the hash.
On Nov 28, 2007 2:25 PM, Christian von Kleist <cvonkleist@gmail.com> wrote:
On Nov 28, 2007 1:55 PM, Junkone <junkone1@gmail.com> wrote:
> hello
> Here is a extract of csv file that i use
> Ticker,Trade,Date,Price
> FLWS,Long,01/08/2007 2:00:00 PM,9.05
>
> It will always have only 2 rows. How can i load it as a hash so that i
> get access it like
> hashvar["Ticker"] .....
> It there an existing api or do i have to load it as csv and then looop
> thro the array and create the hash.
>
> thanks for the help in advance.
>
>
If the file is always two lines and the format is always the same, I'd do: