my code is
# importing pandas for csv file operations
import pandas as pd
# filename to store the filename, change it to your filename
fileName = 'survey.csv'
# Creating a dataframe by opening the given file
df = pd.read_csv(fileName)
# converting the date string to datetime
pd.to_datetime(df['Timestamp'])
Question - Python code to drop the data values from your data set where the age is less than 1 or greater than 99 BY USING DROP FUNCTION.
DO NOT CHANGE ORIGINAL DATA FRAME
Example of function required is df_data.drop(df_data[df_data.salary<0].index,inplace=True)
• Print the shape of your new data frame using the shape property.
• Has the number of columns changed?
• Has the number of rows changed?
• Explain why each has or has not changed.
Step by stepSolved in 3 steps
- In Python: The Broadway dataset contains data for Broadway shows' Capacity (percentage of the theatre filled) and Gross Potential (maximum amount that can be earned) for multiple shows in a specific month and year. Given a CSV file name read from user input, write a program that performs the following tasks: Read in the CSV file as a dataframe. Insert a new column labelled "Size" at the end of the dataframe. The "Size" column contains values in column "Gross Potential" divided by 2. Output the dataframe using the print() function. Create a scatter plot of "Gross Potential" vs "Capacity" with the following marker styling parameters: markers: 'x' color: orange size: values in column "Size" Add the x-label ("Capacity", fontsize = 10), y-label ("Gross Potential", fontsize = 10), and title ("Gross Potential vs Capacity", fontsize = 16) to the figure. Add gridlines to the figure using '--' as linestyle. Save the figure as output_fig.png. Click here to view Input and Output Examplearrow_forward>> classicVinyls.cpp For the following program, you will use the text file called “vinyls.txt” attached to this assignment. The file stores information about a collection of classic vinyls. The records in the file are like the ones on the following sample: Led_Zeppelin Led_Zeppelin 1969 1000.00 The_Prettiest_Star David_Bowie 1973 2000.00 Speedway Elvis_Presley 1968 5000.00 Spirit_in_the_Night Bruce_Springsteen 1973 5000.00 … Write a declaration for a structure named vinylRec that is to be used to store the records for the classic collection system. The fields in the record should include a title (string), an artist (string), the yearReleased (int), and an estimatedPrice(double). Create the following…arrow_forwardpython please Do not need create the file"summer.txt", just need steps.arrow_forward
- This is for Python - COP 1000, I have to use def main. I have attached the program I need help with (2), along with the program one instructions and code that I have below. Thank you!program6_2.pyThis program reads the text file created in the program above and displays its data. Use f-strings to create a table of rows and columns with column headings as follows: PLAYER COLUMN: 10 characters wide and left-aligned. GOALS COLUMN: 6 characters wide and centered. ASSISTS COLUMN: 8 characters wide and centered. TOTAL COLUMN: 6 characters wide and centered. After printing the stats for each player, the program should report the name of the top scorer and his total points (goals + assists).program6_1.pyWrite a program that uses a while loop to store goals and assists for Lightning players in a text file. The program should prompt the user for player names, goals, and assists as shown below. Enter data for at least five players. You can make up the names and data. Each datum should be stored…arrow_forwardWrite the code segments based on the given descriptions: Declare a file pointer called input. Open a file called location.txt for reading using this pointer. If the file is not available, display “File does not exist.”. The content of the text file location.txt is as shown below. It includes the location, latitude and longitude values. FILE location.txt CONTENTS <Location> <Latitude> <Longitude> UTM 1.5523763 103.63322 KLCC 3.153889 101.71333 UM 3.1185 101.665 UMS 6.0367 116.1186 UNIMAS 1.465174 110.4270601 Ask the user to enter a location. Check if the user’s location can be found in the text file. If found, display the location, latitude and longitude as shown below. SAMPLE OUTPUT Enter a location: UM Location : UM Latitude : 3.1185 Longitude : 101.6650 Otherwise display “Sorry, location could not be found”. SAMPLE OUTPUT Enter a location : MMU Sorry, location could not be foundarrow_forwardIn pythonarrow_forward
- Code in C language. Please provide code for 3 different files. One header file and two .C files. I need the code for each file. Please provide photos of the output and source code for each file (3). Please follow All instructions in the photo provided. Use the provided input.txt file provided below. A1, A2 20294 Lorenzana Dr Woodland Hills, CA 91364 B1, B2 19831 Henshaw St Culver City, CA 94023 C1, C2 5142 Dumont Pl Azusa, CA 91112 D1, D2 20636 De Forest St Woodland Hills, CA 91364 A1, A2 20294 Lorenzana Dr Woodland Hills, CA 91364 E1, E2 4851 Poe Ave Woodland Hills, CA 91364 F1, F2 20225 Lorenzana Dr Los Angeles, CA 91111 G1, G2 20253 Lorenzana Dr Los Angeles, CA 90005 H1, H2 5241 Del Moreno Dr Los Angeles, CA 91110 I1, I2 5332 Felice Pl Stevenson Ranch, CA 94135 J1, J2 5135 Quakertown Ave Thousand Oaks, CA 91362 K1, K2 720 Eucalyptus Ave 105 Inglewood, CA 89030 L1, L2 5021 Dumont Pl Woodland Hills, CA 91364 M1, M2 4819 Quedo Pl Westlake Village, CA 91362 I1, I2 5332 Felice Pl…arrow_forwardI need this code to pythonarrow_forwardComputer Science Please use go language programma to write this code. Write a program that creates a CSV file to store and retrieve data such as name, age, and salary. You should be able to read the data out of the file and display the data sorted by name. Hint: Make use of the Sort package to sort the data. Make sure you check the existence of the file, closing the file when there is an error Use defer, panic, and recover as needed.arrow_forward
- Please use C++ code and only use the libraries <iostream> and <fstream>. Thank you!arrow_forwardplease provide code and explanation with output (list student)arrow_forwardpython: def txt_to_csv(input_file): """ Question 3 - cats.txt contains information about cat breeds and their various characteristics. - Read the cats.txt with FILE I/O. - These are TAB separated values - Use a list of lists to create a CSV file with the appropriate data WITHOUT WHITESPACE (remove \t) named "cleaned_cats.csv". - Exclude the "body_type" column - If a row has a length < 5, remove it. - For strings containing extra quotes, strip the extra quotes. - Return the list of lists. Args: input_file (cats.txt) Returns: List of lists Output: [['breed', 'type', 'coat_type', 'coat_pattern'], ['Abyssinian', 'Natural', 'Short', 'Ticked tabby'], ['Aegean', 'Natural', 'Semi-long', 'Multi-color'], ['American Bobtail', 'Mutation', 'Semi-long', 'All'], ['American Curl', 'Mutation', 'Semi-long', 'All'], ['American Ringtail', 'Mutation', 'Semi-long', 'All'], ['American Shorthair', 'Natural', 'Short', 'All'], ...…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY