Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task :: Data Exploration Given the dataset and the starting code answer the questions stated on this task. Questions + Analysis 2. Data Cleaning Write

Task :: Data Exploration

  • Given the dataset and the starting code answer the questions stated on this task.

Questions + Analysis

2. Data Cleaning

Write 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

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?

main.py

#########################################################

# Do Not Edit the Python Code Underneath #

# These lines of codes are written for the assignment #

#########################################################

dataset = None # Global Dataset variable initialization

with open('candy.csv', 'r') as datafile:

# Reading the Dataset File --> candy.csv; must be in the same directory

dataset = datafile.readlines()

# New Line removing function + map operation

removeNewLine = lambda x : x.replace(' ', '')

dataset = list(map(removeNewLine, dataset))

# Split strings to list by commas functions + map operation

commaSplit = lambda x : x.split(',')

dataset = list(map(commaSplit, dataset))

# end of file read

print('Our Candy Dataset ', dataset) # Uncomment this line to see your dataset

# You may start your code underneath this line.

# the dataset variable is accessible. You may choose to use it, or you can

# copy it via dataset.copy()

data link: https://docs.google.com/spreadsheets/d/14t9c8uqW0kFjrBjWGuQwom-IR76WbfKXT50qRtl46Kk/edit#gid=0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Which of these barriers occurred on the USS Enterprise?

Answered: 1 week ago