@@ -236,6 +236,28 @@ DataFrameTest >> testAddRowAtPosition [
236236 self assert: df equals: expected
237237]
238238
239+ { #category : #tests }
240+ DataFrameTest >> testAddRowAtPositionWithKeysAsColumnNames [
241+ | row expected |
242+
243+ row := DataSeries
244+ withKeys: #( 'Population' 'BeenThere' 'City' )
245+ values: #( 2.141 true Paris )
246+ name: ' X' .
247+ df addRow: row atPosition: 2 .
248+
249+ expected := DataFrame withRows: #(
250+ (Barcelona 1.609 true)
251+ (Paris 2.141 true )
252+ (Dubai 2.789 true )
253+ (London 8.788 false )).
254+
255+ expected rowNames: #(A X B C) .
256+ expected columnNames: #(City Population BeenThere) .
257+
258+ self assert: df equals: expected
259+ ]
260+
239261{ #category : #tests }
240262DataFrameTest >> testAddRowNameMustBeDistinct [
241263
@@ -295,6 +317,28 @@ DataFrameTest >> testAddRowSizeMismatch [
295317 self should: aBlock raise: SizeMismatch
296318]
297319
320+ { #category : #tests }
321+ DataFrameTest >> testAddRowWithKeysAsColumnNames [
322+
323+ | row expected |
324+ row := DataSeries
325+ withKeys: #( 'Population' 'BeenThere' 'City' )
326+ values: #( 2.141 true Paris )
327+ name: ' X' .
328+ df addRow: row.
329+
330+ expected := DataFrame withRows:
331+ #( #( Barcelona 1.609 true )
332+ #( Dubai 2.789 true )
333+ #( London 8.788 false )
334+ #( Paris 2.141 true ) ).
335+
336+ expected rowNames: #( A B C X ) .
337+ expected columnNames: #( City Population BeenThere ) .
338+
339+ self assert: df equals: expected
340+ ]
341+
298342{ #category : #tests }
299343DataFrameTest >> testApplyElementwise [
300344
0 commit comments