danfo.Series.str.search(str) [source]
Parameters | Type | Description | Default |
str | String | the string to search for | "" |
Returns:
return Series: Series of index position
Example
obtain the index position for a character
const dfd = require("danfojs-node")let data = ['lower part ', ' CAPITALS city', ' this is a sentence', ' SwAp CaSe']let sf = new dfd.Series(data)sf.str.search("S").print()
╔═══╤══════════════════════╗║ │ 0 ║╟───┼──────────────────────╢║ 0 │ -1 ║╟───┼──────────────────────╢║ 1 │ 8 ║╟───┼──────────────────────╢║ 2 │ -1 ║╟───┼──────────────────────╢║ 3 │ 2 ║╚═══╧══════════════════════╝
Obtain the index position for a searched word
const dfd = require("danfojs-node")let data = ['lower city ', ' CAPITALS city', ' this is a sentence', ' SwAp CaSe']let sf = new dfd.Series(data)sf.str.search("city").print()
╔═══╤══════════════════════╗║ │ 0 ║╟───┼──────────────────────╢║ 0 │ 6 ║╟───┼──────────────────────╢║ 1 │ 10 ║╟───┼──────────────────────╢║ 2 │ -1 ║╟───┼──────────────────────╢║ 3 │ -1 ║╚═══╧══════════════════════╝