In the Titanic datasets, how do I extract the letter in the Cabin column?
Since Cabin is a columns and you can apply any function to a column using the apply function in python. This function can be applied on a series(column) of a dataframe.
The apply takes a function as an input and the corresponding column on which it is supposed to be applied. You need to define the function yourself. This function will simple extract the letter from the Cabin. To extract the first letter from a string you can simply use the syntax value[0].