Question: Having a very hard time completing this assignment in Python code. There were also 3 downloadable files to go along with it. One is data.csv

Having a very hard time completing this assignment in Python code.

There were also 3 downloadable files to go along with it.

One is data.csv - has table of values in it

One is nycflights.csv - has table of flight info in it

One is Assignment_2_questions.jpynb with this in it:

{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "a9d483d8", "metadata": {}, "outputs": [], "source": [ "#import libraries here " ] }, { "cell_type": "code", "execution_count": null, "id": "b23f7327", "metadata": {}, "outputs": [], "source": [ "# Q1:Read the data.csv using numpy. ", "# hint: use np.genfromtxt() function in numpy. You also need to define columns names ", " ", "#Write your code here" ] }, { "cell_type": "code", "execution_count": null, "id": "b85b6e2b", "metadata": {}, "outputs": [], "source": [ "#Q2: Create a numpy array by selecting pulse column from the dataset and name it \"Pulse\" " ] }, { "cell_type": "code", "execution_count": null, "id": "47947c57", "metadata": {}, "outputs": [], "source": [ "#Q3 Create a numpy array by selecting Maxpulse column from the dataset and name it \"MaxPulse\" " ] }, { "cell_type": "code", "execution_count": null, "id": "a7812d23", "metadata": {}, "outputs": [], "source": [ "#Q4 Add Pulse and MaxPulsey using np.sum() and np.add() ", "#What is the difference between summation and addition? ", "#declare a new variable and save the result of np.add() ", " " ] }, { "cell_type": "code", "execution_count": null, "id": "657211ee", "metadata": {}, "outputs": [], "source": [ "#Q5 Find and print all the indexes where Pulse = 100 " ] }, { "cell_type": "code", "execution_count": null, "id": "5be48b29", "metadata": {}, "outputs": [], "source": [ "#Q6 Filter rows where Pulse is greater than 130 and Calories are greate than 400 " ] }, { "cell_type": "code", "execution_count": null, "id": "745d7afd", "metadata": {}, "outputs": [], "source": [ "# Pandas exercise ", " ", "#Q7 Create three Pandas series from numpyarray. Create three numpy arrays by selecting column 2,3,4 from the dataset. ", " ", " ", "# Q8 Create a new dataframe 'df' from pandas series which were created in Q6. ", " " ] }, { "cell_type": "code", "execution_count": null, "id": "3a82d3ec", "metadata": {}, "outputs": [], "source": [ "#Q9 Read nycflights.csv file using pandas. Create a new dataframe by selecting dep_time, dep_delay, arr_time, arr_delay, tailnum ", "# and name it newyork_flight_new. Display with the first fice entries ", " ", " ", "#show the first five entries ", " " ] }, { "cell_type": "code", "execution_count": null, "id": "a5cd8be1", "metadata": {}, "outputs": [], "source": [ "#Q10 Filter newyork_flight_new by selecting rows where departure time is greater than 2000 and name it dep_time_2000. ", "# How many rows were deleted? ", " " ] }, { "cell_type": "code", "execution_count": null, "id": "3fb54d4b", "metadata": {}, "outputs": [], "source": [ "#Q11 Do we have any missing values in dep_delay? If yes replace the missing values with the median of dep_delay. ", "#Hint: replace the missing values in dep_time_2000. " ] }, { "cell_type": "code", "execution_count": null, "id": "f292f5b4", "metadata": {}, "outputs": [], "source": [ "#Q12 create a new dataframe by adding dep_delay and arr_delay and name it \"total_delay\". Add new column\"total_delay\" to the ", "#dep_time_2000 ", " " ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }

Having a very hard time completing this assignment in Python code. Therewere also 3 downloadable files to go along with it. One is

Instructions: You have two options for how to submit your assignments: Option 1. You can submit two files only: one file, a pdf showing your code and outputs, and the second file, an executable python file. Option 2: you can upload a google colab or jupyter notebook file that you previously executed so that we can see the output (a .html file). In either case, your files must be named properly your_name_assignment\#.py/pdf/html/etc, You Must have a header inside your file with your name and assignment description at the very minimum. You can add other things, such as the class, due date, professor, etc. Q10: Filter newyork_flight_new by selecting rows where departure time is greater than 2000 and name it dep_time_2000. How many rows were deleted? Q11: Do we have any missing values in dep_delay? If yes, replace the missing values with the median of dep_delay. Hint: replace the missing values in dep_time_2000. Q12: create a new data frame by adding dep_delay and arr_delay and name it "total_delay." Add a new column, "total_delay," to the dep_time_2000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!