def build_data(self): cnt = 1 with open(self.filename, newline='') as csvfile: datareader = csv.reader(csvfile, delimiter=',') for row in datareader: if cnt == 1: cnt += 1 continue # Skip first line with only column names #print(row) if len(row[1]) > 0: self.Date = u.format_date(row[0]) self.AverageTemperature = u.scrub_decimal(row[1]) # Build dictionary for the selected month if u.is_month(self.Date, self.month): self.result_dict[self.Date] = round( self.AverageTemperature, 2) cnt += 1 return self.result_dict
next_target_goal = 100000 next_target = next_target_goal # Import csv with open(filename, newline='') as csvfile: datareader = csv.reader(csvfile, delimiter=',') for row in datareader: if cnt == 1: cnt += 1 continue #Skip first line with only column names #print(row) Date = u.format_date(row[0]) AverageTemperature = u.scrub_decimal(row[1]) AverageTemperatureUncertainty = u.scrub_decimal(row[2]) City = row[3] Country = row[4] Latitude = row[5] Longitude = row[6] if City not in cities: cities.append(City) """ print("Date: {}".format(Date)) print("AverageTemperature: {}".format(u.scrub_decimal(AverageTemperature))) print("AverageTemperatureUncertainty: {}".format(u.scrub_decimal(AverageTemperatureUncertainty))) print("City: {}".format(City)) print("Country: {}".format(Country)) print("Latitude: {}".format(Latitude))
start = end - no_years # Import csv with open(filename, newline = '') as csvfile: datareader = csv.reader(csvfile, delimiter=',') for row in datareader: if cnt == 1: cnt += 1 continue #Skip first line with only column names #print(row) if len(row[1]) > 0: Date = u.format_date(row[0]) AverageTemperature = u.scrub_decimal(row[1]) #Build dictionary for the selected month if u.is_month(Date, month): result_dict[Date] = AverageTemperature cnt += 1 # Prepare graph data x = [] # xt = [] #Years y_cnt = [] #Temperatures cnt = 1 for race_label in sorted(result_dict.keys(), reverse=False):