简体   繁体   中英

How to split a data in a single column to multiple columns and also removing special characters associated with it in python?

My data looks like this:

在此处输入图像描述

I need the output to be like this:

在此处输入图像描述

how to clean this data?

you just need to do A = list.split(", ") and/or A = list.split(" ") to split the list wherever there is ", " or " " respectively

if by "special characters" you mean the commas they are getting removed with split(", "). if you mean the line chenges you can do A = list.strip().split(", ")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM