Series.str.capitalize

Capitalize the first character of each string

danfo.Series.str.capitalize(options) [source]

ParametersTypeDescriptionDefault

options

Object

inplace: Whether to perform the operation in-place or not.

{

inplace: false

}

Returns: Series (String element)

Example

Convert the first character of a string to capital letter

const dfd = require("danfojs-node")

let data = ['lower boy', 'capitals', 'sentence', 'swApCaSe']
let sf = new dfd.Series(data)
sf.str.capitalize().print()
╔═══╤══════════════════════╗
║   │ 0                    ║
╟───┼──────────────────────╢
║ 0 │ Lower boy            ║
╟───┼──────────────────────╢
║ 1 │ Capitals             ║
╟───┼──────────────────────╢
║ 2 │ Sentence             ║
╟───┼──────────────────────╢
║ 3 │ Swapcase             ║
╚═══╧══════════════════════╝

Last updated