Question

Write a report over programming. Include numbers on your submission to identify which part of the assignment you are taking c
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. Reading CSV file using Python

The above title was chosen because to read CSV files we can use the library Python has to offer to easily open and read data from CSV files. Python syntax makes the code easier to understand.

2. Python Code:

import csv

with open('file.csv') as csvFileData:
    csvReader = csv.reader(csvFileData, delimiter=',')
    for row in csvReader:
        print(row)

1 import csv with open (file. csv.) as csVFileData: #file.csv. is the csv file that needs to be in the same directory/folde

3. Output:

['John', 'M', '5ft 3in ', '45 kg']
['Harvey', 'M', '6ft 1in', '167 kg']
['Pauline', 'F', '5ft 9in', '59 kg']
['Ruth', 'F', '5ft 11in', '93 kg']


File Edit View Search Terminal Help daikky@Bubuntu:-$ cd Documents/Chegg/Feb/17/ daikky@Bubuntu:-/Documents/Chegg/Feb/17$ ls

4. CSV(Comma-Sepateted Values) files store tabular date in plaintext. Comma (or any other delimiter) is used to separate values in line. Each line stores multiple values for a record.

The import csv is used to import the library files to open csv files in python. The open('file.csv') opens the csv file and the csv.reader(csvFileData, delimiter=',') function reads from it with "," as the delimiter. The file 'file.csv' must reside in the same directory or folder as the readCSV.py python file.


To compile and the program we run the command python readCSV.py from the terminal/command prompt and get out output. It gives an error when the file 'file.csv' is not found in the directory.

Add a comment
Know the answer?
Add Answer to:
Write a report over programming. Include numbers on your submission to identify which part of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need this solution using C++ Write a report over programming. Include numbers on your submission...

    I need this solution using C++ Write a report over programming. Include numbers on your submission to identify which part of the assignment you are taking care of. 1. (10 points) Include a title that explains in a sentence what you learned or noticed. 2. (70 points) Include your code for the programming assignment Write a code to print to a csv file and read from a csv file 3. (10 points) The output of your code that shows what...

  • Java Programming Part 1 File encryption is the science of writing the contents of a file...

    Java Programming Part 1 File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will be a version of the first file, but written in a secret code. Although there are complex encryption techniques, you should come up with a...

  • GIVEN CODE. PLEASE FILL IN THE BLANK. // Include Block #include <fcntl.h> #include <unistd.h> // Preprocessor...

    GIVEN CODE. PLEASE FILL IN THE BLANK. // Include Block #include <fcntl.h> #include <unistd.h> // Preprocessor declarations #define BUF_SIZE 10 /* global constant buffer size: Generally this would be much larger, but I want to show you that it works in a loop until the entire file is read.*/ // main function int main(int argc, char *argv[]) {    // Variable declarations    int fd;                       // file descripter    char buffer[BUF_SIZE];       // string for...

  • To be done in C++ BER PROGRAMMING CONTENT: Submission request: For each program below: supply a...

    To be done in C++ BER PROGRAMMING CONTENT: Submission request: For each program below: supply a copy of the source code provide a screenshot of the output W if you use an online compiler like onlinegdb.com, the link of your final code. 4) (10 points) Static Variables Go to the following link (https://onlinegdb.com/HJd49mBcm) and fork the code so that you can write your own version of the function discount ( to achieve the goal as described in the comments. As...

  • C# P-9 Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming...

    C# P-9 Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming methodologies. Design a class named Contractor. The class should keep the following information: • Contractor name • Contractor number • Contractor start date Write one or more constructors, and the appropriate accessor and mutator functions for the class. For this assignment and P-10 you will have to include an algorithm for you program. This will be a word document attached to the dropbox. Submit...

  • Your next programming assignment at the Research Center is to write a program that reads data...

    Your next programming assignment at the Research Center is to write a program that reads data from a file and produces a report of rainfall for that period of time. The program should read the starting month name from the data file, then read an ending month name, followed by reading in monthly rainfall amounts for each of the months from the starting month through the ending month. As it reads the monthly totals, it should sum (accumulate) the rainfall...

  • Exercises (No programming is required. Your submission should be a word or pdf document.) Question 1:...

    Exercises (No programming is required. Your submission should be a word or pdf document.) Question 1: (3 Marks) Convert from binary the number (11081181), to decimal and show all steps. Question 2: (3 Marks) Convert from decimal (350)e to binary and show all steps Question 3: (3 Marks) Convert from decimal (3567)s to hexadecimal and show all steps. Question 4: (3 Marks) Convert from hexadecimal (45AC)s to octal and show all steps Question 5: (2 Marks) Given the following snippet...

  • Can somebody help me with Java programming? please be brief and explain the process and carefully...

    Can somebody help me with Java programming? please be brief and explain the process and carefully follow the step by step instruction. Thanks Homework 12.1 - Write a program that generates five random sentences (like mad libs), prints them to a file, then reads in the sentences and prints them to the console. Start by creating four string arrays for nouns, verbs, colors, and places. They should store at least 5 of each type of word. You can have more...

  • write programs with detailed instructions on how to execute. code is java What you need to...

    write programs with detailed instructions on how to execute. code is java What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word...

  • For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java...

    For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java program that will input a file of sentences and output a report showing the tokens and shingles (defined below) for each sentence. Templates are provided below for implementing the program as two separate files: a test driver class containing the main() method, and a sentence utilities class that computes the tokens and shingles, and reports their values. The test driver template already implements accepting...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT