CODE:
OUTPUT:
used alert to show the output
the file used in this program
actual output in browser
CODE TO COPY:
<!DOCTYPE html>
<html lang="en">
<head>
<meta
charset="utf-8"/>
</head>
<body>
<script>
function func(file){
//create a raw file
var rawFile = new XMLHttpRequest();
//use that file to open local file
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
//getting all content from the file
var allText = rawFile.responseText;
//split the content on newline
var some=allText.split("\n");
//selecting 3rd line
var some1=some[2];
//split the 3rd line on comma
var some2=some1.split(",");
//creating list of 5 elements by parseint
var
li=[parseInt(some2[0]),parseInt(some2[1]),parseInt(some2[2]),parseInt(some2[3]),parseInt(some2[4])]
//returning that list
alert(li);
return li;
}
}
}
rawFile.send(null)
}
</script>
<input type="file"
id="file">
<input type="submit"
onclick="func('women_top.csv')">
<div
id="fileContents"></div>
</body>
</html>
Write a function named "csv_to_list" that takes a string as a parameter representing the name of...
pythin: Write a function named "computed_column" that takes a string as a parameter representing the name of a CSV file with 5 columns in the format ",,,," and writes a file named "blank.csv" containing all the data from the input file but with a sixth column containing the sum of the values from the second and fourth columns
Write a function named "find_key" that takes a key-value store as a parameter with strings as keys and integers as values. The function returns a boolean representing true if the string "focus" is in the input as a key, false otherwise(javascript)
Define a Python function named borough_count that has one parameter. The parameter is a string representing the name of a CSV file. The CSV file is a subset of NYC's dataset of all film permits issued since April 2016. Each row in the CSV file has the format: Event Id, Police Precinct(s), Event Type, Borough, Category Your function must return a dictionary. The keys of this dictionary will be the boroughs read in from the file (boroughs are at index...
write a function: Names(path): that reads from a file at location path and returns a dictionary mapping from column names to lists containing the data in those columns. The format of the file is a csv file. The first line is a comma separated set of string names for the columns contained in the file. The function will accumulate a dictionary mapping from year to the list of years, from name to the list of names (in the same order),...
Write a function named "find_value" that takes a key-value store as a parameter with strings as keys and integers as values. The function returns a boolean representing true if the value 4 is in the input as a value, false otherwise
project-8a Write a function named count_letters that takes as a parameter a string and returns a dictionary that tabulates how many of each letter is in that string. The string can contain characters other than letters, but only the letters should be counted. The string could even be the empty string. Lower-case and upper-case versions of a letter should be part of the same count. The keys of the dictionary should be the upper-case letters. If a letter does not...
in javascript Write a function named "sort_by_average_rating" that takes a list/array of key-value stores as a parameter where each key-value store has keys "ratings", "budget", and "box_office" where budget and box_office are integers and ratings is a list of integers. Sort the input based on the average of the values in "ratings"
help Question 12 (20 points) Write a function named inverse that takes a single parameter, a dictionary. In this key is a student, represented by a string. The value of each key is a list of courses, each represented by a string, in which the student is enrolled. dictionary each The function inverse should compute and return a dictionary in which each key is a course and the associated value is a list of students enrolled in that course For...
*q3: Write a public static method named q3 that takes no parameters and has return type void. In this method, you may assume there is a file named "properties.csv" with lines in the format "name, opposed, pure,glad" where "name" is a String and all other values are well-formed integers. There is no header line in this file. This method will create a new * file named "output.csv" in the format "name, pure" containing only these two columns from "properties.csv" and...
Write a class named SatData that reads a JSON file containing data on 2010 SAT results for New York City and writes the data to a text file in CSV (comma-separated values) format. It just needs to read a local JSON file - it doesn't need to access the internet. Specifically, your class should have an init method that reads the file, and it should have a method named save_as_csv that takes as a parameter a list of DBNs (district...