TypeError: string indices must be integers using pandas apply with lambda
问题 I have a dataframe, one column is a URL, the other is a name. I'm simply trying to add a third column that takes the URL, and creates an HTML link. The column newsSource has the Link name, and url has the URL. For each row in the dataframe, I want to create a column that has: <a href="[the url]">[newsSource name]</a> Trying the below throws the error File "C:\Users\AwesomeMan\Documents\Python\MISC\News Alerts\simple_news.py", line 254, in df['sourceURL'] = df['url'].apply(lambda x: '{1}'