'Parsing CSV Data from one column with Pandas
Lets say I have column "OU":
OU
CORP:Jenny Smith:
STORE:Mary Poppins:
STORE:Tony Stark:
STORE:Carmen Sandiego:
NEWS:Peter Parker:
NEWS:Clark Kent:
I want to parse this column up to the first ":" and keep only the words before the ":". Then any word that repeats is left only at one. So the finished data should look like this:
OU
CORP
STORE
NEWS
Would I need to do something in the pandas.read_csv(file, usecols=['OU']) when I read the original CSV file?
In reference to an answer below, this is also how that one row looks in a text editor:
OU
CORP:Jenny Smith:
"CORP:John Smith:,John Smith:"
STORE:Mary Poppins:
STORE:Tony Stark:
STORE:Carmen Sandiego:
NEWS:Peter Parker:
NEWS:Clark Kent:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
