Skip to content

Commit 5068058

Browse files
committed
Change DataSeries>>#summary to bring it more in line with Python's pandas describe() by adding Count and Stdev, renaming 1st Qu., Median, 3rd Qu. to 25%, 50% and 75%, as well as reordening the list.
1 parent b8d743e commit 5068058

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/DataFrame-Tests/DataSeriesTest.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,8 +2295,8 @@ DataSeriesTest >> testStatsSummary [
22952295
| expected actual |
22962296

22972297
expected := DataSeries
2298-
withKeys: #(Min '1st Qu.' Median Average '3rd Qu.' Max)
2299-
values: { 3 . 7 . 9 . (115 / 11) . 15 . 20 }
2298+
withKeys: #(Count Average Stdev Min '25%' '50%' '75%' Max)
2299+
values: { 11 . series values average . series values stdev . 3 . 7 . 9 . 15 . 20 }
23002300
name: series name.
23012301

23022302
actual := series summary.

src/DataFrame/DataSeries.class.st

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,18 +1055,22 @@ DataSeries >> sum [
10551055

10561056
{ #category : #statistics }
10571057
DataSeries >> summary [
1058-
"A data series is returned which is a statistical summary of the data series. With keys as different statistical measures and values as the values returned when those statistical measures are applied on the data series."
1058+
"A data series is returned which is a statistical summary of the data series.
1059+
With keys as different statistical measures and values as the values returned
1060+
when those statistical measures are applied on the data series."
10591061

10601062
| summary |
10611063
summary := self species new.
10621064
summary name: self name.
10631065

10641066
summary
1065-
at: 'Min' put: self min;
1066-
at: '1st Qu.' put: self firstQuartile;
1067-
at: 'Median' put: self median;
1067+
at: 'Count' put: self size;
10681068
at: 'Average' put: self average;
1069-
at: '3rd Qu.' put: self thirdQuartile;
1069+
at: 'Stdev' put: self stdev;
1070+
at: 'Min' put: self min;
1071+
at: '25%' put: self firstQuartile;
1072+
at: '50%' put: self median;
1073+
at: '75%' put: self thirdQuartile;
10701074
at: 'Max' put: self max.
10711075

10721076
^ summary

0 commit comments

Comments
 (0)