Question
Use Python 3 in Jupyter Write a function called countUnique that has one parameter which is a NumPy array. The array will be a list
Use Python 3 in Jupyter
Write a function called countUnique that has one parameter which is a NumPy array. The array will be a list of integers with many repeated values. The function should count how many times each unique integer appears and return the counts. For example, if it is given the array array([3, 3, 3, 1, 1, 3, 1, 1, 3, 2]), it should return the counts [(1, 4), (2, 1), (3, 5)] since 1 appears 4 times, 2 appears once, and 3 appears 5 times.
In a separate code cell, create an create a NumPy array of 20 random integers from 1 to 20. Use your countUnique to determine how many times each number appears.
In a separate code cell, create an create a NumPy array of 10,000 random integers from 1 to 5. Use your countUnique to determine how many times each number appears.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started