Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 1.91 KB

File metadata and controls

54 lines (44 loc) · 1.91 KB
description Obtain the position of the last found occurrence of a specified value in a string

Series.str.lastIndexOf

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

Parameters Type Description Default
str string the string to search for ""
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.lastIndexOf("r").print()

{% endtab %}

{% tab title="Browser" %}

{% endtab %} {% endtabs %}

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

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

{% endtab %} {% endtabs %}