I am relatively new to python.
I need to split out some test data (humidity,temperature) from a csv file. The file has no headers but column 0 contains the date, column 1 contains time and column 2 contains the data which I need to split out. The data comes from an Arduino where I measured humidity and temperature.
I can open the file using pandas csv_read but I can't seem to seperate column 2 out using the sep=',' and I can't work out why. Once I have sepearted the data out I need to write this to a new file.
import pandas as pd
file = open('RH_TEMP-13-01-2020-161111.csv', 'r')
df = pd.read_csv(file, sep = ',', header = None)
print(df)
Output:
0 1 2
0 13/01 16:11:13 41.84,20.36,37.19,21.59\n
1 13/01 16:11:15 41.84,20.36,37.17,21.59\n
2 13/01 16:11:16 41.79,20.37,37.25,21.59\n
3 13/01 16:11:18 41.79,20.36,37.25,21.59\n
4 13/01 16:11:19 41.77,20.37,37.04,21.61\n
5 13/01 16:11:20 41.77,20.37,36.95,21.59\n
6 13/01 16:11:22 41.74,20.37,37.69,21.61\n
7 13/01 16:11:23 41.72,20.37,38.48,21.61\n
8 13/01 16:11:25 41.72,20.39,37.94,21.61\n
9 13/01 16:11:26 41.72,20.39,37.54,21.62\n
10 13/01 16:11:27 41.70,20.39,37.25,21.62\n
11 13/01 16:11:29 41.70,20.37,37.04,21.61\n
12 13/01 16:11:30 41.70,20.40,36.95,21.61\n
13 13/01 16:11:32 41.67,20.40,36.90,21.61\n
14 13/01 16:11:33 41.67,20.40,36.92,21.62\n
15 13/01 16:11:34 41.67,20.41,36.87,21.61\n
16 13/01 16:11:36 41.64,20.40,36.87,21.62\n
17 13/01 16:11:37 41.64,20.41,36.87,21.62\n
18 13/01 16:11:39 41.64,20.41,36.90,21.64\n
19 13/01 16:11:40 41.62,20.41,36.90,21.62\n
20 13/01 16:11:42 41.62,20.41,36.90,21.62\n
21 13/01 16:11:43 41.62,20.43,39.02,21.62\n
13/01,16:11:13,"41.84,20.36,37.19,21.59 " 13/01,16:11:15,"41.84,20.36,37.17,21.59 " 13/01,16:11:16,"41.79,20.37,37.25,21.59 " 13/01,16:11:18,"41.79,20.36,37.25,21.59 " 13/01,16:11:19,"41.77,20.37,37.04,21.61 " 13/01,16:11:20,"41.77,20.37,36.95,21.59 "