I have URL column for each record in pandas DataFrame.
Name CRMLinks NamedLink
Clint Eastwood HTTP://example.com/link1/100e1e Clint
Iron Side HTTP://example.com/link2/202e1e Iron
I want to convert CRMLinks and NamedLink column to clickable links to get to the URL that is shown in CRMLinks.
Here is what I have
base_url= 'https://example.com/'
df['CRM'] = base_url + df['CRM']
def make_clickable(link):
# target _blank to open new window
# extract clickable text to display for your link
text = link.split('=')[1]
return f'<a target="_blank" href="{link}">{text}</a>'
# link is the column with hyperlinks
df['CRM'] = df['CRM'].apply(make_clickable)
But I only get this in the df['CRM'] cell.
<a target="_blank" href="HTTP://example.com/link1">100e1e</a>
Thanks