Links

Series.append

Add a new value or values to the end of a Series.
danfo.Series.append(newValue, index, options)
Parameters
Type
Description
Default
newValue
Array, Series
Object to append
index
Array
The new index value(s) to append to the Series. Must contain the same number of values as newValues as they map 1 - 1.
options
Object
{ inplace: Whether to perform operation in-place or not.
}
false

Append new Series to the end of a Series

Node
const dfd = require("danfojs-node")
let sf1 = new dfd.Series([1, 2, 3, 4], { index: ['f1', 'f2', 'f3', 'f4'] })
let sf2 = new dfd.Series(["a", "b", "c"])
new_sf = sf1.append(sf2, ["f5", "f6", "f7"])
new_sf.print()
Output
╔════╤═══╗
║ f1 │ 1 ║
╟────┼───╢
║ f2 │ 2 ║
╟────┼───╢
║ f3 │ 3 ║
╟────┼───╢
║ f4 │ 4 ║
╟────┼───╢
║ f5 │ a ║
╟────┼───╢
║ f6 │ b ║
╟────┼───╢
║ f7 │ c ║
╚════╧═══╝

Append new Series to the end of a Series in-place

Node
const dfd = require("danfojs-node")
let sf1 = new dfd.Series([1, 2, 3, 4], { index: ['f1', 'f2', 'f3', 'f4'] })
let sf2 = new dfd.Series(["a", "b", "c"])
let newIndex = ["f5", "f6", "f7"]
sf1.append(sf2, newIndex, { inplace: true })
sf1.print()
╔════╤═══╗
║ f1 │ 1 ║
╟────┼───╢
║ f2 │ 2 ║
╟────┼───╢
║ f3 │ 3 ║
╟────┼───╢
║ f4 │ 4 ║
╟────┼───╢
║ f5 │ a ║
╟────┼───╢
║ f6 │ b ║
╟────┼───╢
║ f7 │ c ║
╚════╧═══╝

Append an array to the end of Series

Node
Browser
let sf1 = new dfd.Series([1, 2, 3, 4], { index: ['f1', 'f2', 'f3', 'f4'] })
let sfArr = ["a", "b", "c"]
new_sf = sf1.append(sfArr, ["f5", "f6", "f7"])
new_sf.print()
Output
╔════╤═══╗
║ f1 │ 1 ║
╟────┼───╢
║ f2 │ 2 ║
╟────┼───╢
║ f3 │ 3 ║
╟────┼───╢
║ f4 │ 4 ║
╟────┼───╢
║ f5 │ a ║
╟────┼───╢
║ f6 │ b ║
╟────┼───╢
║ f7 │ c ║
╚════╧═══╝