Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/DataFrame-Tests/DataFrameTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,21 @@ DataFrameTest >> testAsDataFrame [
self assert: actual equals: expected
]

{ #category : #tests }
DataFrameTest >> testAsDataFrameDataTypes [

| actual expected |
actual := #( #( a 1 3.1 )
#( b 2 6.5 )
#( c 3 9.7 ) ) asDataFrame dataTypes.
expected := Dictionary newFrom: {
(1 -> Object).
(2 -> SmallInteger).
(3 -> SmallFloat64) }.

self assert: actual equals: expected
]

{ #category : #tests }
DataFrameTest >> testAsDataFrameEmpty [

Expand Down
5 changes: 4 additions & 1 deletion src/DataFrame/Collection.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ Collection >> asDataFrame [
| value |
value := row at: colIndex ifAbsent: [ nil ].
dataFrame at: rowIndex at: colIndex put: value ] ].

1 to: numberOfColumns do: [ :colIndex |
dataFrame dataTypes
at: colIndex
put: (dataFrame columnAt: colIndex) calculateDataType ].

^ dataFrame
]
Expand Down