Hi,
I have float number datas coming with 60, 600 and 6000 rows. Is there a convenient way to let NeoCSV load and convert to array of floats. So far, I am doing it by "hand" with stream? Thanks Hilaire -- Dr. Geo http://drgeo.eu |
Hi Hilaire,
I think data frame is better for such case https://github.com/PolyMathOrg/DataFrame
Cheers, Cedrick et bonne fêtes ;) Le 22 déc. 2019 à 17:04, Hilaire <[hidden email]> a écrit :
|
In reply to this post by HilaireFernandes
Hi Hilaire,
Maybe I don't understand your question, but reading floats with NeoCSV is quite elementary: data := '10.5,-7.5\10.4,-7.4\10.3,-7.3\10.2,-7.2\10.1,-7.1' withCRs. (NeoCSVReader on: data readStream) addFloatField; addFloatField; upToEnd. "#(#(10.5 -7.5) #(10.4 -7.4) #(10.3 -7.3) #(10.2 -7.2) #(10.1 -7.1))" There is even a #addFloatFieldRadixPointComma that shows how to do more custom number reading. Or do you want something else ? Sven > On 22 Dec 2019, at 17:03, Hilaire <[hidden email]> wrote: > > Hi, > > I have float number datas coming with 60, 600 and 6000 rows. > > Is there a convenient way to let NeoCSV load and convert to array of floats. > > So far, I am doing it by "hand" with stream? > > Thanks > > Hilaire > > -- > Dr. Geo > http://drgeo.eu > > > |
The data come from sensors in 60, 600 and 6000 fields.
I can do has below but I need to know first the number of fields. But it's ok. csv := (NeoCSVReader on: stream) separator: Character tab. 60 timesRepeat: [ csv addFloatField]. csv upToEnd inspect. Le 22/12/2019 à 17:34, Sven Van Caekenberghe a écrit : > Or do you want something else ? -- Dr. Geo http://drgeo.eu |
In reply to this post by cedreek
Merci Cedrick.
Looks nice. I heard a bit about on Serge's presentation on polymath. Can you do analysis like prediction with? Joyeuses fêtes également Le 22/12/2019 à 17:11, Cédrick Béler a écrit : > I think data frame is better for such case > > https://github.com/PolyMathOrg/DataFrame -- Dr. Geo http://drgeo.eu |
In reply to this post by HilaireFernandes
Is there a header row? IF so you can do:
csv := (NeoCSVReader on: stream) separator: Character tab. header:= csv readHeader. header size timesRepeat:[csv addFloatField]. csv upToEnd inspect HilaireFernandes wrote > The data come from sensors in 60, 600 and 6000 fields. > > I can do has below but I need to know first the number of fields. But > it's ok. > > csv := (NeoCSVReader on: stream) separator: Character tab. > 60 timesRepeat: [ csv addFloatField]. > csv upToEnd inspect. > > Le 22/12/2019 à 17:34, Sven Van Caekenberghe a écrit : >> Or do you want something else ? > > -- > Dr. Geo > http://drgeo.eu -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html |
Yes, Paul, I was about to write the same thing.
> On 22 Dec 2019, at 18:44, Paul DeBruicker <[hidden email]> wrote: > > Is there a header row? IF so you can do: > > csv := (NeoCSVReader on: stream) separator: Character tab. > header:= csv readHeader. > header size timesRepeat:[csv addFloatField]. > csv upToEnd inspect > > > > > > HilaireFernandes wrote >> The data come from sensors in 60, 600 and 6000 fields. >> >> I can do has below but I need to know first the number of fields. But >> it's ok. >> >> csv := (NeoCSVReader on: stream) separator: Character tab. >> 60 timesRepeat: [ csv addFloatField]. >> csv upToEnd inspect. >> >> Le 22/12/2019 à 17:34, Sven Van Caekenberghe a écrit : >>> Or do you want something else ? >> >> -- >> Dr. Geo >> http://drgeo.eu > > > > > > -- > Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html > |
In reply to this post by Paul DeBruicker
There is no header. I think it is a non-standard case. Thanks for the
suggestion. Le 22/12/2019 à 18:44, Paul DeBruicker a écrit : > Is there a header row? IF so you can do: > > csv := (NeoCSVReader on: stream) separator: Character tab. > header:= csv readHeader. > header size timesRepeat:[csv addFloatField]. > csv upToEnd inspect -- Dr. Geo http://drgeo.eu |
Free forum by Nabble | Edit this page |