Skip to content

Commit be8d477

Browse files
Runnable examples for statistics methods of DataFrame.
1 parent 79d8a66 commit be8d477

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

src/DataFrame/DataFrame.class.st

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,9 @@ DataFrame >> atAll: indexes [
604604
{ #category : #statistics }
605605
DataFrame >> average [
606606
"Average is the ratio of sum of values in a set to the number of values in the set"
607-
607+
608+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame average) >>> (Dictionary newFrom: {(1 -> 20).(2 -> 2)})"
609+
608610
^ self applyToAllColumns: #average
609611
]
610612

@@ -1124,7 +1126,9 @@ DataFrame >> first [
11241126

11251127
{ #category : #statistics }
11261128
DataFrame >> firstQuartile [
1127-
"25% of the values in a set are smaller than or equal to the first Quartile of that set"
1129+
"25% of the values in a set are smaller than or equal to the first Quartile of that set"
1130+
1131+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame firstQuartile) >>> (Dictionary newFrom: {(1 -> 10).(2 -> 1)})"
11281132

11291133
^ self applyToAllColumns: #firstQuartile
11301134
]
@@ -1447,6 +1451,8 @@ DataFrame >> inspectionItems: aBuilder [
14471451
DataFrame >> interquartileRange [
14481452
"The Inter Quartile Range is the difference between the third Quartile and the first Quartile"
14491453

1454+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame interquartileRange) >>> (Dictionary newFrom: {(1 -> 20).(2 -> 2)})"
1455+
14501456
^ self applyToAllColumns: #interquartileRange
14511457
]
14521458

@@ -1516,13 +1522,17 @@ DataFrame >> leftJoin: aDataFrame onLeft: leftColumn onRight: rightColumn [
15161522
{ #category : #statistics }
15171523
DataFrame >> max [
15181524
"Max is the largest value present in a set of values"
1519-
1525+
1526+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame max) >>> (Dictionary newFrom: {(1 -> 30).(2 -> 3)})"
1527+
15201528
^ self applyToAllColumns: #max
15211529
]
15221530

15231531
{ #category : #statistics }
15241532
DataFrame >> median [
1525-
"50% of data points have a value smaller or equal to the median . The median of a set of values is the middle value of the set when the set is arranged in increasing order."
1533+
"50% of data points have a value smaller or equal to the median . The median of a set of values is the middle value of the set when the set is arranged in increasing order."
1534+
1535+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame median) >>> (Dictionary newFrom: {(1 -> 20).(2 -> 2)})"
15261536

15271537
^ self applyToAllColumns: #median
15281538
]
@@ -1531,13 +1541,17 @@ DataFrame >> median [
15311541
DataFrame >> min [
15321542
"Min is the smallest value present in a set of values"
15331543

1544+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame min) >>> (Dictionary newFrom: {(1 -> 10).(2 -> 1)})"
1545+
15341546
^ self applyToAllColumns: #min
15351547
]
15361548

15371549
{ #category : #statistics }
15381550
DataFrame >> mode [
15391551
"The mode of a set of values is the value that appears most often. "
15401552

1553+
"(#(#(10 3) #(10 1) #(30 3)) asDataFrame mode) >>> (Dictionary newFrom: {(1 -> 10).(2 -> 3)})"
1554+
15411555
^ self applyToAllColumns: #mode
15421556
]
15431557

@@ -1727,6 +1741,8 @@ DataFrame >> privateRowNames: anArray [
17271741
DataFrame >> range [
17281742
"Range is the difference between the highest value and the lowest value in a set"
17291743

1744+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame range) >>> (Dictionary newFrom: {(1 -> 20).(2 -> 2)})"
1745+
17301746
^ self applyToAllColumns: #range
17311747
]
17321748

@@ -2479,7 +2495,9 @@ DataFrame >> sortDescendingByAll: arrayOfColumnNames [
24792495

24802496
{ #category : #statistics }
24812497
DataFrame >> stdev [
2482-
"Standard deviation is a measure of how dispersed the data is in relation to the average"
2498+
"Standard deviation is a measure of how dispersed the data is in relation to the average"
2499+
2500+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame stdev) >>> (Dictionary newFrom: {(1 -> 10).(2 -> 1)})"
24832501

24842502
^ self applyToAllColumns: #stdev
24852503
]
@@ -2502,7 +2520,9 @@ DataFrame >> tail: aNumber [
25022520

25032521
{ #category : #statistics }
25042522
DataFrame >> thirdQuartile [
2505-
"75% of the values in a set are smaller than or equal to the third Quartile of that set"
2523+
"75% of the values in a set are smaller than or equal to the third Quartile of that set"
2524+
2525+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame thirdQuartile) >>> (Dictionary newFrom: {(1 -> 30).(2 -> 3)})"
25062526

25072527
^ self applyToAllColumns: #thirdQuartile
25082528
]
@@ -2775,7 +2795,9 @@ DataFrame >> transposed [
27752795

27762796
{ #category : #statistics }
27772797
DataFrame >> variance [
2778-
"variance measures how far each number in the set is from the average value of the set. It is the square of standard deviation."
2798+
"variance measures how far each number in the set is from the average value of the set. It is the square of standard deviation."
2799+
2800+
"(#(#(10 3) #(20 1) #(30 2)) asDataFrame variance) >>> (Dictionary newFrom: {(1 -> 100).(2 -> 1)})"
27792801

27802802
^ self applyToAllColumns: #variance
27812803
]

0 commit comments

Comments
 (0)