I built a data logger with a Raspberry Pi Pico. The Data Logger saves the temperature every six minutes in the TXT file. I am currently failing to import the data from the TXT file into Python.
The data looks like this:
1,20.5,2,21.0,3,21.0,4,21.0,5,21.0,6,21.0,7,21.0,...
The data set thus contains two variables, which are separated by commas, an incrementing counter and the temperature with one decimal place. The dataset has about 240 measurements.
So far I have tried different methods to import the data. I have turned the TXT file into a CSV file and tried importing as a dataframe using pandas:
temp_df = pd.read_csv('temp_data.csv', header=None)
This gives me a df with one observation and a three-digit number of variables. I cannot import the dataset to have only two variables and about 240 observations.
I also tried to import the data as lists:
import csv
file = open("temp_data.csv", "r")
temp_list = list(csv.reader(file, delimiter=","))
file.close()
print(temp_list)
Which results in the error:
"TypeError: 'list' object is not callable".
--> All in all, I need a solution that uses the TXT file directly and creates a df. I am still very inexperienced with Python and hope for your help! Thanks in advance