Skip to content

Latest commit

 

History

History
51 lines (42 loc) · 1.89 KB

series.str.indexof.md

File metadata and controls

51 lines (42 loc) · 1.89 KB
description
the position of the first found occurrence of a specified value in a string

Series.str.indexOf

danfo.Series.str.indexOf(str, options) [source]

Parameters Type Description Default
str string the string to obtain its index ""
options Object inplace: Whether to perform the operation in-place or not.

{

inplace: false

}

Returns: Series

Example

{% tabs %} {% tab title="Node" %}

const dfd = require("danfojs-node")

let data = ['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']
let sf = new dfd.Series(data)
sf.str.indexOf("C").print()

{% endtab %}

{% tab title="Browser" %}

{% endtab %} {% endtabs %}

{% tabs %} {% tab title="Output" %}

╔═══╤══════════════════════╗
║   │ 0                    ║
╟───┼──────────────────────╢
║ 0 │ -1                   ║
╟───┼──────────────────────╢
║ 1 │ 0                    ║
╟───┼──────────────────────╢
║ 2 │ -1                   ║
╟───┼──────────────────────╢
║ 3 │ 4                    ║
╚═══╧══════════════════════╝

{% endtab %} {% endtabs %}