Skip to content

Commit 97af31d

Browse files
#columns now returns an array of Dataseries. Changed the implementation of #hasNils as it used #columns
1 parent d76fb52 commit 97af31d

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/DataFrame-Tests/DataFrameTest.class.st

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,10 @@ DataFrameTest >> testColumnTransformNotFound [
758758
DataFrameTest >> testColumns [
759759

760760
| expectedCollection |
761-
762-
expectedCollection := #(
763-
(Barcelona Dubai London)
764-
(1.609 2.789 8.788)
765-
(true true false)).
761+
expectedCollection := {
762+
(df columnAt: 1).
763+
(df columnAt: 2).
764+
(df columnAt: 3) } asArray.
766765

767766
self assert: df columns equals: expectedCollection
768767
]

src/DataFrame/DataFrame.class.st

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +722,9 @@ DataFrame >> columnNames: aCollection [
722722

723723
{ #category : #accessing }
724724
DataFrame >> columns [
725-
726725
"Returns a collection of all columns"
727726

728-
^ self asArrayOfColumns
727+
^ (1 to: self numberOfColumns) collect: [ :j | self columnAt: j ]
729728
]
730729

731730
{ #category : #accessing }
@@ -1054,9 +1053,7 @@ DataFrame >> hasNils [
10541053

10551054
| arrayOfColumns |
10561055
arrayOfColumns := self columns.
1057-
1 to: self numberOfColumns do: [ :column |
1058-
1 to: self numberOfRows do: [ :row |
1059-
((arrayOfColumns at: column) at: row) ifNil: [ ^ true ] ] ].
1056+
arrayOfColumns collect: [ :column | column hasNil ifTrue: [ ^ true ] ].
10601057
^ false
10611058
]
10621059

0 commit comments

Comments
 (0)