Question:
I want to output the following table in pandas. I only have thedescription
column so far but I want to split on the comma and output the contents before the comma in the commondescrip
column.I have the description column right now, I need the commondescrip column
description | commondescrip |
---|---|
00001 | 00001 |
00002 | 00002 |
00003,Area01 | 00003 |
00004 | 00004 |
00005,Area02 | 00005 |
I tried
How can I fix it so that I can achieve the above the table and split it to output before the comma?
Answer:
Here is one way to do itIf you have better answer, please add a comment about this, thank you!