Source

data_munging_code_kata / weather / temp_spread.py

import math
import re
from kutil import dry

class TemperatureSpread(dry.BaseFileDifferentialObject):

	def _clean_string(self , string):
		return ''.join(e for e in string if e.isalnum())

	def eval_row(self,row):
		return (row[0],math.fabs( int(self._clean_string(row[1])) - int(self._clean_string(row[2])) ) )
		
	def is_row_data(self,row):
		return len(row) > 0 and re.search("^[0-9]*$",row[0])