I am trying to read in temperature data from a .csv file using pandas. Here is a sample of the file:
My issue is that my code is not extracting the data to 1 decimal place? This is what I have at the moment:
# Import packages import pandas as pd # Open data file data_file_name = "data_set.csv" data_file = pd.read_csv(data_file_name, header=2).astype(int) # Extract temperature data target_data = data_file["Temperature"].astype(float) print(target_data.loc[])
After adding in the print statement to see if the first value is -23.5 as it should be, instead I get:
Why isn't my code reading the data as a float with 1 d.p?