0

Really basic question, but I am trying to convert what I think is a list into a string, but it's not working.

I have a dataframe like:

<OUT> merged
ID      Tags
1     [architecture]
2     [people, loss, chocolate]
3     [rest, exif, castle]

I want to remove the '[]' and ','. I have tried but to no avail:

' '.join(str(i) for i in merged['Tags'])
1
  • 1
    list(map(lambda x: ' '.join(x), merged['tags'])). Edit I think you can just go with @BENY 's answer, seems like you expect that as the output. Commented May 17, 2022 at 15:24

1 Answer 1

1

Let us try

merged['new'] = merged['Tags'].str.join(' ')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.