I have a dataframe whose data are strings and different information are mixed in a single column. Like this:
| 0 | Place: House |
| 1 | Date/Time: 01/02/03 at 09:30 |
| 2 | Color:Yellow |
| 3 | Place: Street |
| 4 | Date/Time: 12/12/13 at 13:21:21 |
| 5 | Color:Red |
df = pd.DataFrame(['Place: House','Date/Time: 01/02/03 at 09:30', 'Color:Yellow', 'Place: Street','Date/Time: 21/12/13 at 13:21:21', 'Color:Red'])
I need the dataframe like this:
| Place | Date/Time | Color |
|---|---|---|
| House | 01/02/03 | Yellow |
| Street | 21/12/13 | Red |
I started by converting the excel file to csv, and then I tried to open it as follows:
df = pd.read_csv(filename, sep=":")
I tried using the ":" to separate the columns, but the time formatting also uses ":", so it didn't work. The time is not important information so I even tried to delete it and keep the date, but I couldn't find a way that wouldn't affect the other information in the column either.