I have a pandas dataframe, in which in one column I have a list of hashtags. Now, I would like to delete all elements in that list expect the first one of each row. Is there a way of doing this?
CodePudding user response:
A simple way to do so:
df.hashtags = df.hashtags.map(lambda l: l[:1])
