Series.str.indexOf

the position of the first found occurrence of a specified value in a string

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

ParametersTypeDescriptionDefault

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

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()
╔═══╤══════════════════════╗
║   │ 0                    ║
╟───┼──────────────────────╢
║ 0 │ -1                   ║
╟───┼──────────────────────╢
║ 1 │ 0                    ║
╟───┼──────────────────────╢
║ 2 │ -1                   ║
╟───┼──────────────────────╢
║ 3 │ 4                    ║
╚═══╧══════════════════════╝

Last updated