Skip to content

Commit b730a47

Browse files
committed
#isNumerical should return true when columns includes nils
1 parent f6723a9 commit b730a47

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/DataFrame-Tests/DataSeriesTest.class.st

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,19 @@ DataSeriesTest >> testInjectInto [
13921392
self assert: actual equals: expected
13931393
]
13941394

1395+
{ #category : #'tests - testing' }
1396+
DataSeriesTest >> testIsNumerical [
1397+
1398+
self assert: #( 1 2 3 ) asDataSeries isNumerical.
1399+
self deny: #( 1 2 '3' ) asDataSeries isNumerical
1400+
]
1401+
1402+
{ #category : #'tests - testing' }
1403+
DataSeriesTest >> testIsNumericalWithNils [
1404+
1405+
self assert: #( 1 nil 3 ) asDataSeries isNumerical
1406+
]
1407+
13951408
{ #category : #'tests - accessing' }
13961409
DataSeriesTest >> testLast [
13971410

src/DataFrame/DataSeries.class.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ DataSeries >> isCategorical [
420420

421421
{ #category : #'categorical-numerical' }
422422
DataSeries >> isNumerical [
423-
^ forcedIsNumerical ifNil: [self uniqueValues allSatisfy: [:each|each isNumber]]
423+
424+
^ forcedIsNumerical ifNil: [ (self uniqueValues copyWithout: nil) allSatisfy: [ :each | each isNumber ] ]
424425
]
425426

426427
{ #category : #testing }

0 commit comments

Comments
 (0)