Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Converting List to String – Python

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

' '.join(str(i) for i in merged['Tags'])

>Solution :

Let us try

merged['new'] = merged['Tags'].str.join(' ')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading