I have data in txt file. The data is stored as a single column. But I need to extract columns from rows. When I read the data using pd.read_table() method, it returns as a single column and many rows. For example, I have .txt file like that:
- Date: 23:15
- Temperature: 20 C
- Humidity: 40
- CO2 level: 14
- Date: 23:20
- Temperature: 28 C
- Humidity: 45
- CO2 level: 18
- Date: 23:25
- Temperature: 35 C
- Humidity: 35
- CO2 level: 20
- Date: 23:30
- Temperature: 22 C
- Humidity: 52
- CO2 level: 12
and more .....
As you can see, the Date, Temperature, Humidity, CO2 are repeating, so they should be treated as columns, and values they assign should be treated as rows respect to its category. For example:
| Date | Temperature | Humidity | CO2 level |
|---|---|---|---|
| 23:15 | 20 C | 40 | 14 |
| 23:20 | 28 C | 45 | 18 |
| 23:25 | 35 C | 35 | 20 |
| 23:30 | 22 C | 52 | 12 |
it should assign like that