Concept explainers
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 Example
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
- Please write the code in carrow_forwardThere is a csv file called Air_Quality.csv. It has 12 columns and 17,000 rows. One column titled 'Name' which has a various emissions listed in it. Another column titled 'Geo Place Name' has a list of cities. Write a code (in the most basic Python) which finds an emission called Traffic Density within the column and prints out which city has the most Traffic Density based on a column called 'Data Value' Below is a picture of a small chunk of the csv file.arrow_forwardMy Python program analyzes data from a CSV file that is all numbers. This program is designed to find the median and standard deviation I'm trying to figure out a part where if the last column of the file contains zeros, it finds where the numbers are in the same row indexes of the other columns. It then calculates the average of these numbers. However, my program calculates them by columns first, not by rows. How could this be fixed? For example, if the last column had a zero and another column had a three in the same row index and another with 4, those numbers would be calculated. # Lucas Conklin# 5772707import csvimport statistics def readCSVIntoDictionary(f_name): data = [] with open(f_name) as f: reader = csv.reader(f) for row in reader: if not data: for index in range(len(row)): data.append([]) for index in range(len(row)): data[index].append(float(row[index])) f.close() return…arrow_forward
- STARTING OUT WITH PYTHON FOURTH EDITION TONY GRADDIS CHAPTER 8, QUESTION 14 GAS PRICE SOLVE a question from "Starting out with Python" by Tony Gaddis Chapter 8, question number 14, the title "Gas Prices" In the student sample program files for this chapter, you will find a text file named GasPrices.txt. The file contains the weekly average prices for a gallon of gas in the United States, beginning on April 5th, 1993, and ending on August 26th, 2013. Figure 8-7 shows an example of the first few lines of the file's contents:(ATTACHED) Each line in the file contains the average price for a gallon of gas on a specific date. Each line is formatted in the following way: MM-DD-YYYY: price MM is the two-digit month, DD is the two-digit day, and YYYY is the four-digit year. Price is the average price per gallon of gas on the specified date. For this assignment, you are to write one or more programs that read the contents of the file and perform the following calculations: Average Price Per…arrow_forwardIN JAVA ONLY PLEASE. POSITIVE REVIEW WILL BE LEFT FOR CORRECT LANGUAGE ONLY AND NOT COPY PASTE FROM INCORRECT ANSWER A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txt and the contents of ParkPhotos.txt are: Acadia2003_photo.jpg AmericanSamoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns2010_photo.jpg CraterLake1996_photo.jpg…arrow_forwardProgram - Python Create a simple text file called mycandy The first line of the file will be Candy Name, Candy Calories, Total Fat Grams Next, add five lines to the file by hand using your favorite five candy bars information. Each line's data will be separated by commas.arrow_forward
- A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txtand the contents of ParkPhotos.txt are:…arrow_forwardPlease Program in python and leave comments to help explain here is the google drive with the Test.xlsm file: https://drive.google.com/drive/folders/16utzb5_h7yMCN8_13E_JqasfcpykZOYr?usp=sharing The objective is to create a code in Python that can extract the columns highlighted in blue and output them to a .txt file. The code should be able to generate the text file with the columns that are highlighted in blue and store them on a seperate folder. Below shows how the Test.xlsm file looks like as well as how the text file should look like when the code extracts and outputs it.arrow_forwardPlease Program in python and leave comments to help explain here is the google drive with the Test.xlsm file: https://drive.google.com/drive/folders/16utzb5_h7yMCN8_13E_JqasfcpykZOYr?usp=sharing The objective is to create a code in Python that can extract the columns highlighted in blue and output them to a .txt file. The code should be able to generate the text file with the columns that are highlighted in blue and store them on a seperate folder. Below shows how the Test.xlsm file looks like as well as how the text file should look like when the code extracts and outputs it. The attached images is how we want to format the text file when/after extracting the columns highlighted in blue. The code should name the output text file according to the sheet name " Correct-L.txt " and its header should contain " Band Group Number Time " just so we know where it begins or when the next column is.arrow_forward
- In this project, you will develop algorithms that find road routes through the bridges to travel between islands. The input is a text file containing data about the given map. Each file begins with the number of rows and columns in the map considered as maximum latitudes and maximum longitudes respectively on the map. The character "X" in the file represents the water that means if a cell contains "X" then the traveler is not allowed to occupy that cell as this car is not drivable on water. The character "0" in the file represents the road connected island. That means if a cell contains "0" then the traveler is allowed to occupy that cell as this car can drive on roads. The traveler starts at the island located at latitude = 0 and longitude = 0 (i.e., (0,0)) in the upper left corner, and the goal is to drive to the island located at (MaxLattitude-1, MaxLongitudes-1) in the lower right corner. A legal move from an island is to move left, right, up, or down to an immediately adjacent…arrow_forwardCan you please help me do this C++ program, its for a class called Object Oriented Programming inarrow_forwardWrite a code segment that searches a Grid object for a negative integer. The loop should terminate at the first instance of a negative integer in the grid, and the variables row and column should be set to the position of that integer. Otherwise, the variables row and column should equal the number of rows and columns in the grid. *Pythonarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education