Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make sure your Python code compiles. Any non - compiling code will receive a very lowmark. Naming : YourDeptStudentNumberInitialNameLastNameAssignmentNumber.py , For example, CoE 6 4

Make sure your Python code compiles. Any non-compiling code will receive a very lowmark.Naming : YourDeptStudentNumberInitialNameLastNameAssignmentNumber.py,For example, CoE64123456MalekMalkawiA2.py (Not following the naming rule meansZERO). You will submit only Python/Jupyter files.Carefully read the questions and pay special attention to sentences that involve should,should not,do not, and other underlined/bold font statements.If you use code from a resource (website, book, etc.), make sure that you reference thoseresources at the top of your source code file in the form of comments. You should givedetails of which part of your code is from what resource. Failing to do so may resultin a plagiarism investigation.Any similarity in your source codes will have serious consequences for both parties.Late Submission Policy: late submissions will NOT be accepted.1
Question 1- Data Manipulating: Pandas(26 Pts)Implement the following tasks by using Pandas library.[Task-1.1](2 Pts) Load the csv file nba.csv into a DataFrame and display the firstten rows.[Task-1.2](4 Pts) Print names of NBA players whose salary is greater than 20 milliondollars.[Task-1.3](4 Pts) In Height column, the heights of NBA players are given in feetand inches. Convert the unit of height to cm updating the same column.[Task-1.4](4 Pts) Create a Data Frame including the names of teams in the firstcolumn and the average height of their players in the second column. Print the result.[Task-1.5](4 Pts) Plot a bar chart using Matplotlib to show the top 5 NBA teamswith the highest average height of their players. Set label names and titles.[Task-1.6](4 Pts) In the College column, some information is missing (NaN). Re-move the rows having NaN values in Collage column.[Task-1.7](4 Pts) In the Salary column, some information is missing (NaN). Cal-culate the average salary of all NBA players and fill the NaN values with the averagesalary value.Question 2- Data Manipulating: Pandas(18 Pts)Implement the following tasks by using Pandas library.[Task-2.1](2 Pts) Load stateareas.csv,stateabbrevs.csv and statepopulation.csvfiles into separate DataFrames and print them.[Task-2.2](4 Pts) Merge stateabbrevs and stateareas. Name the DataFrame asdf1. Print the result.[Task-2.3](4 Pts) Merge df1 and statepop using necessary keywords to obtainthe Data Frame given in Figure-1. Name the DataFrame as df2. Print the result.2
Figure 1: Expected result of Task-2.3[Task-2.4](4 Pts) Print the rows of states having NaN values in the population oryear column in df2. Remove these rows from df2 and print the result again.[Task-2.5](4 Pts) Obtain a new DataFrame df3 from df2 with columns state,year,ages and density by calculating density as population per area. Sort df3in ascending order by density. Display the results.Question 3- Matplotlib(24 Pts)Implement the following tasks by using Matplotlib library.[Task-3.1](12 Pts) Plot sine, cosine, tangent, and cotangent functions as 2-by-2 sub-plots inside one figure. For all functions, set the range of x-axis between 0 and 360\deg .For the sine and cosine, set the range of y-axis between -1 and 1. For the tangent andcotangent, adjust the range of y-axis to avoid extreme values. Split the grids into 8equal portions in x and y axis. Set different colors for each function graph. Draw tan-gent and cotangent graphs with dashed lines. Add a legend to the upper right cornerof each subplot. Add title to each subplot.[Task-3.2](12 Pts) Load the csv file californiacities.csv into a DataFrame. Extractdata of latd,longd,areatotalkm2, and areawaterpercent. You are expectedto draw a scatter plot. Set x-axis as latitude and set y-axis as longitude. Set the size ofthe points to represent the total area of cities. Add a legend to the upper right cornerof the figure and show sizes of points for 10,25,50,100, and 250 km2. Set the colorsof the points to represent the percentage of water in the area. Add a color bar next tothe figure. Set the label

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

How is the NDAA used to shape defense policies indirectly?

Answered: 1 week ago