File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2833,26 +2833,25 @@ DataFrameTest >> testNumericalColumnNames [
28332833 #( Female 22 Spain 95 ) #( Male 24 Portugal 99 ) ).
28342834 dataFrame columnNames: #( Gender Age Country Score ) .
28352835
2836- expected := #( Age Score ) asOrderedCollection .
2836+ expected := #( Age Score ) .
28372837
28382838 self assert: dataFrame numericalColumnNames equals: expected
28392839]
28402840
28412841{ #category : #tests }
28422842DataFrameTest >> testNumericalColumns [
28432843
2844- | dataFrame expected |
2844+ | dataFrame expectedCollection |
28452845 dataFrame := DataFrame withRows:
28462846 #( #( Male 21 Argentina 94 ) #( Female 20 France 97 )
28472847 #( Female 22 Spain 95 ) #( Male 24 Portugal 99 ) ).
28482848 dataFrame columnNames: #( Gender Age Country Score ) .
28492849
2850- expected := DataFrame withRows:
2851- #( #( 21 94 ) #( 20 97 ) #( 22 95 ) #( 24 99 ) ).
2852-
2853- expected columnNames: #( Age Score ) .
2850+ expectedCollection := {
2851+ (dataFrame columnAt: 2 ).
2852+ (dataFrame columnAt: 4 ) } asArray.
28542853
2855- self assert: dataFrame numericalColumns equals: expected
2854+ self assert: dataFrame numericalColumns equals: expectedCollection
28562855]
28572856
28582857{ #category : #splitjoin }
Original file line number Diff line number Diff line change @@ -1431,15 +1431,15 @@ DataFrame >> numberOfRows [
14311431DataFrame >> numericalColumnNames [
14321432 " Returns the names of all numerical columns of the dataframe"
14331433
1434- ^ self columnNames select: [ :columnName |
1435- (self dataTypes at: columnName) includesBehavior: Number ]
1434+ ^ self numericalColumns collect: [ :column | column name ]
14361435]
14371436
14381437{ #category : #accessing }
14391438DataFrame >> numericalColumns [
14401439 " Returns all numerical columns of the dataframe"
14411440
1442- ^ self columns: self numericalColumnNames
1441+ ^ self columns select: [ :column |
1442+ (self dataTypes at: column name) includesBehavior: Number ]
14431443]
14441444
14451445{ #category : #splitjoin }
You can’t perform that action at this time.
0 commit comments