[Jprogramming] Importing CSVs into J arrays

Björn Helgason gosinn at gmail.com
Tue Dec 13 05:41:29 HKT 2005


Take a look at verb chop
require'misc'
    ',' chop 'jfslk,flgkjsdf,æfkgsæd'
chop splits on LF or its left arg
read files in with fread
require'files'
a=.   fread 'filename'
split the file
b=.chop a

then split each record
c=. ',' chop each b



2005/12/12, Joseph Malone <jlawrenceiv at gmail.com>:
> I went through the 'Mapped Files' and 'Mapped Files Database' labs, but
> I would like to know simply how I can load a csv of numbers into J - ie
> comma separated, rather than just loading bytes that do not discriminate
> file separators.  The Mapped Files lab mentions being able to load very
> large files representing a day's worth of market data.  It is this sort
> of utility I am interested in.  Can someone please point me to a place
> with some further documentation on this??
>
> Thanks
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


--
Björn Helgason, Verkfræðingur, gsm: +354698 5532
Fugl&Fiskur ehf, Þerneyjarsund 23,
802 Selfoss ,t-póst: gosinn at gmail.com
http://www.linux.is/forritun/data/J/grunnur.pdf


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |
  (`-.  '--.)
   `. )----'


More information about the Programming mailing list