Reputation: 277
I am dealing with DNA sequencing data, and each column looks something like "ACCGTGC". I would like to transform this into several columns, where each column contains only one char. How to do this in Python pandas?
Upvotes: 1
Views: 48
Reputation: 863256
For performance convert values to lists and pass to DataFrame
constructor:
df1 = pd.DataFrame([list(x) for x in df['col']], index=df.index)
If need add to original:
df = df.join(df1)
Upvotes: 1