Question: Suppose you have a csv file, named data.csv, with the following content: 12345 678910 11 12 13 14 15 16 17 18 19 20
Suppose you have a csv file, named data.csv, with the following content: 12345 678910 11 12 13 14 15 16 17 18 19 20 Write python code using pandas to do the following: (a) Read the content of the file and store it in a dataframe named data. (b) Print out the first three rows. (c) Print out the number of rows and columns. (d) Compute the minimum value of the 2nd column. (e) What would this code produce: print(data.iloc[[2, 1],[1, 3]]) (f) Extract the first three rows and write them to a file named data1.csv. (g) Change the even numbers in column 2 to 0 and the odd numbers in column 2 to 1. (h) Scale the numbers in column 3 so that they are all from 0 to 1. (i) Add a column at the end - each entry should have the value 1. (j) Add a row at the end - each entry should have the value 2. (k) Delete the 3rd column.
Step by Step Solution
There are 3 Steps involved in it
import pandas as pd a Read the content of the file and store it in a dataframe named data data ... View full answer
Get step-by-step solutions from verified subject matter experts
