Question: Complete the function below. It will take a a list of values and a partitioning method and applies the method on the list. It will
Complete the function below. It will take a a list of values and a partitioning method and applies the method on the list. It will return a list of list.
- Parameters:
- a list of values
- a partitioning method: equal-frequency ('ef') or equal-width ('ew')
- number of values in each bin for equal-frequency method
- number of bins for equal-width method
- a partitioned list of list.
- def partitioning(input_list, method='ef', bin_frequency=5, bin_count=5):
input_list.sort()
output_list = []
# Equal-frequency partitioning
if method == 'ef':
# Write your code here
pass
# Equal-width partitioning
if method == 'ew':
# Write your code here
pass
return output_list - here is the data set that i have:
fat age 32.1 21 32.3 22 36.6 22 11.9 24 12.9 24 37.3 24 31.9 25 30.7 26 12.5 26 31 26 26.2 27 14.9 27 18.7 27 32.4 27 22.2 27 9.3 28 37.8 28 25.3 29 24.4 29 15.4 29 35.5 29 17.7 30 26.9 31 27 31 20.3 31 14.7 32 10.5 32 43.7 32 6.2 32 25.2 33 15.4 35 25.2 35 8.1 35 20.6 35 17.4 36 21.7 37 28.5 37 42.2 37 37.1 38 40.1 38 11.5 38 28.2 39 15.6 40 34.5 40 30.5 40 24.4 40 33.5 40 16.6 41 35.6 42 14.2 42 23.8 43 32 43 41.9 43 24.6 44 29.6 44 8.1 44 6.5 44 35.5 44 28.6 45 15.2 45 9.5 46 12.9 46 41 46 15.3 47 16.4 47 31.5 47 17.1 47 29.3 47 9.7 47 17.7 48 6.5 48 30.3 48 14 49 31.7 49 21.9 50 37.6 51 33.5 51 41.2 51 28.8 51 20.5 52 42.2 52 12.3 53 38.6 53 10.5 54 43.7 54 13.8 54 19.7 54 39.4 55 10.3 55 11.6 56 14.2 56 44.5 56 32.3 57 33 57 30.4 57 20.1 57 34.3 57 32.8 57 43.2 58 6.6 59 36.4 59 42.3 61 8.5 61 44.5 61 12.4 61 41 62 9.3 62 20.8 62 15.4 62 14.1 63 39.7 63 18.2 63 25.2 63 34.9 64 8.2 65 18.5 65 6.5 65 23.4 65 38.7 65 9.2 65
Step by Step Solution
3.47 Rating (167 Votes )
There are 3 Steps involved in it
def partitioninginputlist methodef binfrequency5 bincount5 inpu... View full answer
Get step-by-step solutions from verified subject matter experts
