Step 1: Sample Weather Dataset Year, Temperature 2018,30 2018,32 2018,29 2019,35 2019,33 2019,31 2020,36 2020,38 2020,37 Mapper Code (mapper.py) import sys for line in sys.stdin: line = line. Strip() if line.startswith("Year"): continue year, temp = line.Split(",") print(f"{year}\t{temp}") Reducer Code (reducer.py) import sys current_year = None max_temp = -999 for line in sys.stdin: line = line.strip() year, temp = line.split("\t") temp = int(temp) if current_year == year: max_temp = max(max_temp, temp) else: if current_year: print(f"{current_year}\t{max_temp}") current_year = year max_temp = temp if current_year == year: print(f"{current_year}\t{max_temp}") Google Colab Implementation Code # Upload dataset from google.colab import files uploaded = files.upload() # Install Hadoop !apt-get install openjdk-8-jdk-headless -qq > /dev/null !wget -q https://downloads.apache.org/hadoop/common/hadoop-3.3.6/hadoop 3.3.6.tar.gz !tar xf hadoop-3.3.6.tar.gz # Create Mapper File %%writefile mapper.py import sys for line in sys.stdin: line=line.strip() if line.startswith("Year"): continue year,temp=line.split(",") print(f"{year}\t{temp}") # Create Reducer File %%writefile reducer.py import sys current_year=None max_temp=-999 for line in sys.stdin: line=line.strip() year,temp=line.split("\t") temp=int(temp) if current_year==year: max_temp=max(max_temp,temp) else: if current_year: print(f"{current_year}\t{max_temp}") current_year=year max_temp=temp if current_year==year: print(f"{current_year}\t{max_temp}") # Run MapReduce !cat weather.csv | python mapper.py | sort | python reducer.py