Application of Functional Programming Assignment
Task :: Data Exploration
• Given the dataset and the starting code answer the questions stated on this task.
• Read the article: The Ultimate Halloween Candy Ranking
Dataset Information
Features Explanation:
Questions + Analysis
1. Functional Programming Warm-up
Which candy has the longest name?
2. Data Cleaning
Write a cleaning function such that:
• Preserves the name of the candy as a string
• Turns all strings of 1s and 0s to a True or False
• Turns all string percentiles into float
(Write a function, then map that function to the entire list of candies)
Take advantage of mapping and lambda
3. How many candies are multi-featured?
Multi-featured → A candy that is more than 1 type of candy (eg. Chocolate + Caramel)
4. Clustering
Cluster/group the candies by their type.
• Which group has the highest win percentile?
• Which group has the lowest win percentile?
• Does the sugar percentile of the group matter?
• Does the price percentile matter?
• Should candies be clustered/grouped based on multi-feature or on their single features?
• Should candy be allowed to exist in multiple groups since some are multi-featured?
5. Extrema Analysis (sugar percentile, price percentile, win percentile)
• What is the best hard candy?
• What is the worst hard candy?
• What is the average hard candy?
• What is the best candy bar?
• What is the worst candy bar?
• What is the average candy bar?
• What is the best pluribus?
• What is the worst pluribus?
• What is the average pluribus?
• What would be the best healthiest candy?
Last Question.
• Is it better to be multi-featured or single-featured candy in terms of performance of the candy winning?
• Feel free to try any data analytic practices you have learned in Data Management.
Instructions
You are to use the two given files to help you answer the questions.
Throughout the assignment, you do not need to use functional programming. I just want to see your Python Skills. There shouldn’t be any reason to use OOP however.
You are given two files:
File 1: candy.csv … you do not need to edit this file, you just need it in the same directory/location as your python file
File 2: candy_reader.py … if you are using repl.it you can just copy and paste the contents inside the main.py while you copy over the candy.csv in the repl.it as well.
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.