Skip to content

Commit d106a14

Browse files
Fixed bug in #toString
1 parent dd769e7 commit d106a14

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/DataFrame/DataFrame.class.st

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,9 @@ DataFrame >> toString [
24582458

24592459
columnWidths := dataFrame columnNames collect: [ :columnName |
24602460
| maxWidth |
2461-
maxWidth := columnName size.
2461+
columnName isString
2462+
ifFalse: [ maxWidth := columnName asString size ]
2463+
ifTrue: [ maxWidth := columnName size ].
24622464
dataFrame rows do: [ :row |
24632465
| value |
24642466
value := row at: columnName.
@@ -2467,8 +2469,11 @@ DataFrame >> toString [
24672469

24682470
dataFrame columnNames withIndexDo: [ :columnName :index |
24692471
| paddedColumnName |
2470-
paddedColumnName := columnName padRightTo: (columnWidths at: index).
2471-
stringTable nextPutAll: paddedColumnName, ' ' ].
2472+
paddedColumnName := (columnName isString
2473+
ifFalse: [ columnName asString ]
2474+
ifTrue: [ columnName ]) padRightTo:
2475+
(columnWidths at: index).
2476+
stringTable nextPutAll: paddedColumnName , ' ' ].
24722477
stringTable cr.
24732478

24742479

0 commit comments

Comments
 (0)