Powered By GitBook
Series.str.indexOf
the position of the first found occurrence of a specified value in a string
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
Node
Browser
1
const dfd = require("danfojs-node")
2
3
let data = ['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']
4
let sf = new dfd.Series(data)
5
sf.str.indexOf("C").print()
Copied!
1
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ -1 ║
5
╟───┼──────────────────────╢
6
║ 1 │ 0 ║
7
╟───┼──────────────────────╢
8
║ 2 │ -1 ║
9
╟───┼──────────────────────╢
10
║ 3 │ 4 ║
11
╚═══╧══════════════════════╝
Copied!
Last modified 24d ago
Copy link