At first, I have to write function GetTitle() method, where takes string, and this function must split the name till comma, then again split till dot, next convert the title to lower case and finally return this value of the title.
I wrote function, but I don’t get how to use or rewrite this function for series of string
def GetTitle(Name):
k=Name.split(" ")
item=k[1]
title=item.split(".")
res=title[0]
lower_res=res.lower()
return lower_res
This my column, where I should use this function
Photo
>Solution :
Assuming you wish to run your defined function on column "Name" & your data is loaded as df… Try this then;
df["Title"] = df["Name"].apply(lambda x: GetTitle(str(x)))