| description | Joins two or more strings/arrays |
|---|
danfo.Series.str.concat(other, position, options) [source]
| Parameters | Type | Description | Default |
|---|---|---|---|
| other | string or Array | string or list of strings to add to each string element of the series | "" |
| position | Int | The position to add the other (string or array) is either 0 or 1. 0 is to add the other at the beginning of each of the string element, and 1 is to add to the end of the string element | 1 |
| options | Object | inplace: Whether to perform the operation in-place or not. | { inplace: false } |
Returns: Series (String element)
Examples
Add the strings from an Array to the start of each of the String element in Series
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = ['lower boy', 'CAPITALS', 'sentence', 'SwApCaSe']
let data2 = ['XX', 'YY', 'BB', '01']
let sf = new dfd.Series(data)
sf.str.concat(data2,0).print(){% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
βββββ€βββββββββββββββββββββββ
β β 0 β
βββββΌβββββββββββββββββββββββ’
β 0 β XXlower boy β
βββββΌβββββββββββββββββββββββ’
β 1 β YYCAPITALS β
βββββΌβββββββββββββββββββββββ’
β 2 β BBsentence β
βββββΌβββββββββββββββββββββββ’
β 3 β 01SwApCaSe β
βββββ§βββββββββββββββββββββββ
{% endtab %} {% endtabs %}
Add the strings from an Array to the end of each of the String element in Series
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = ['lower boy', 'CAPITALS', 'sentence', 'SwApCaSe']
let data2 = ['XX', 'YY', 'BB', '01']
let sf = new dfd.Series(data)
sf.str.concat(data2,1).print(){% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
βββββ€βββββββββββββββββββββββ
β β 0 β
βββββΌβββββββββββββββββββββββ’
β 0 β lower boyXX β
βββββΌβββββββββββββββββββββββ’
β 1 β CAPITALSYY β
βββββΌβββββββββββββββββββββββ’
β 2 β sentenceBB β
βββββΌβββββββββββββββββββββββ’
β 3 β SwApCaSe01 β
βββββ§βββββββββββββββββββββββ
{% endtab %} {% endtabs %}
Add a string to the start of each string element in a Series
{% tabs %} {% tab title="Output" %}
const dfd = require("danfojs-node")
let data = ['lower boy', 'CAPITALS', 'sentence', 'SwApCaSe']
let data2 = ['XX', 'YY', 'BB', '01']
let sf = new dfd.Series(data)
sf.str.concat("pre",0).print(){% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
βββββ€βββββββββββββββββββββββ
β β 0 β
βββββΌβββββββββββββββββββββββ’
β 0 β prelower boy β
βββββΌβββββββββββββββββββββββ’
β 1 β preCAPITALS β
βββββΌβββββββββββββββββββββββ’
β 2 β presentence β
βββββΌβββββββββββββββββββββββ’
β 3 β preSwApCaSe β
βββββ§βββββββββββββββββββββββ
{% endtab %} {% endtabs %}
Add a string to the end of each string element in a series
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = ['lower boy', 'CAPITALS', 'sentence', 'SwApCaSe']
let data2 = ['XX', 'YY', 'BB', '01']
let sf = new dfd.Series(data)
sf.str.concat("post",1).print(){% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
βββββ€βββββββββββββββββββββββ
β β 0 β
βββββΌβββββββββββββββββββββββ’
β 0 β lower boypost β
βββββΌβββββββββββββββββββββββ’
β 1 β CAPITALSpost β
βββββΌβββββββββββββββββββββββ’
β 2 β sentencepost β
βββββΌβββββββββββββββββββββββ’
β 3 β SwApCaSepost β
βββββ§βββββββββββββββββββββββ