From 753b70c3efff571f624a58bb7ec1b8903de3bc40 Mon Sep 17 00:00:00 2001 From: Sean DeNigris Date: Tue, 7 Nov 2023 20:35:05 -0500 Subject: [PATCH] [Enh]: CSV - As *Order Preserving* Dictionaries --- src/ResourcesLive/RlCSV.class.st | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ResourcesLive/RlCSV.class.st b/src/ResourcesLive/RlCSV.class.st index 711a1ed..ac0ab34 100644 --- a/src/ResourcesLive/RlCSV.class.st +++ b/src/ResourcesLive/RlCSV.class.st @@ -24,6 +24,17 @@ RlCSV >> asDictionaries [ upToEnd ]. ] +{ #category : #accessing } +RlCSV >> asOrderPreservingDictionaries [ + "Requires a header, the columns of which will become the dictionary keys" + + ^ self neoCSVReaderDo: [ :rdr | + rdr + namedColumnsConfiguration; + recordClass: OrderPreservingDictionary; + upToEnd ]. +] + { #category : #accessing } RlCSV >> dataFrame [ ^ #DataFrame asClass readFromCsv: self file