70 solutions available
Question 1Assertion. Python Panda library offers functionality to interact with a CSV file.Reason. Panda's read_csv() and to_csv() functions can...
Question 2Assertion. The read_csv() function of Python Pandas can read data of a csv file into any of pandas data structures.Reason. DataFrame is a...
Question 3Assertion. The read_csv() function reads a csv file's data into a DataFrame.Reason. The to_csv() function writes a DataFrame on to a csv...
Question 4Assertion. The read_sql() function of Pandas can query upon any mysql database.Reason. The read_sql() function can query upon only those...
Question 5Assertion. A DataFrame's data can be exported as a table of a mysql database.Reason. Over an established connection to a mysql database,...
Question 1What is CSV file ? Is it a text file ?
Question 2Name the function you would use to read data from a CSV file into a DataFrame.
Question 3Name the function you would use to store data from a DataFrame into a CSV file.
Question 4Which function lets you fetch data from an SQL table into a DataFrame ?
Question 5Which function lets you store data of a DataFrame into an SQL table ?
Question 6Which additional argument would you give to append the data of a DataFrame in an existing SQL table ?
Question 1Full form of CSV is comma separated value.
Question 2Default separator of CSV files is , (comma).
Question 3To load data of a CSV file in a DataFrame read_csv function is used.
Question 4To write data of a DataFrame in a CSV file, to_csv function is used.
Question 5To specify a separator other than comma in a CSV file, sep argument is used.
Question 6To specify the string to represent NaN values in a CSV file, na_rep argument in to_sql() is used.
Question 7To load data in a DataFrame from mysql table, read_sql() function is used.
Question 8To write data of a DataFrame in a mysql table, to_sql() function is used.
Question 1CSV stands for :Column Separated ValueClass Separated ValueComma Separated ValueNone of the above
Question 2A CSV file can take ............... character as separator.,~|\tonly (a)all of these
Question 3In order to work with CSV files from panda, you need to import ............... , other than pandas..csvpandas.ionewcsvno extra package...
Question 4The correct statement to read from a CSV file in a DataFrame is :<DF>.read_csv(<file>)<File>. read_csv(...
Question 5Which argument do you specify with read_csv() to specify a separator character ?charactercharseparatorsep
Question 6To suppress first row as header, which of the following arguments is to be given in read_csv() ?noheader = Trueheader = Noneskipheader =...
Question 7To read specific number of rows from a CSV file, which argument is to be given in read_csv() ?rows = <n>nrows = <n>n_rows =...
Question 8To skip first 5 rows of CSV file, which argument will you give in read_csv() ?skiprows = 5skip_rows = 5skip = 5noread = 5
Question 9To skip 1st, 3rd and 5th row of CSV file, which argument will you give in read_csv() ?skiprows = 1 | 13 | 5skiprows = [1, 5, 1]skiprows =...
Question 10While reading from a CSV file, to use a column's values as index labels, argument given in read_CSV() is...
Question 11While writing a DataFrame onto a CSV file, which argument would you use in to_csv() for NaN values' representation as NULL ?NaN =...
Question 12Which of the following libraries let you establish a connection with a MySQL database from within Python ?mysql.connectorPymysql,...
Question 13In pandas.read_sql(<A>, <B>), <A> isconnection nametable nameSQL query stringdatabase name
Question 14In pandas.read_sql(<A>, <B>), <B> isconnection nametable nameSQL query stringdatabase name
Question 15To suppress the creation of a column for index labels of a DataFrame, ............... argument is specified in to_sql().if_exists =...
Question 16To append the content of DataFrame in a table of MySQL, ............... argument is used in to_sql().if_exists = "Add"if_exists =...
Question 1CSV files can only store comma separated values.
Question 2The number of rows in a DataFrame are by default equal to number of rows in a CSV file, it created from a CSV file.
Question 3Pandas can only read from CSV files but can't write CSV files.
Question 4You need to import CSV package in order to store a DataFrame in a CSV file.
Question 5The read_csv() can handle different separator characters but not to_csv().
Question 6In order to read from a MySQL table into a DataFrame, the table must exist.
Question 7The to_sql() function can append to a MySQL table.
Question 8The to_sql() function cannot create a MySQL table.
Question 9The to_sql() function cannot work if the named table already exists.
Question 10The read_sql() can also read from CSV files.
Question 1What are advantages of CSV file formats ?
Question 2What all libraries do you require in order to bring data from a CSV file into a DataFrame ?
Question 3You want to read data from a CSV file in a DataFrame but you want to provide your own column names to DataFrame. What additional argument...
Question 4By default, read_csv() uses the values of first row as column headers in DataFrames. Which argument will you give to ensure that the...
Question 5Which argument would you give to read_csv() if you only want to read top 10 rows of data ?
Question 6Write command to store data of DataFrame mdf into a CSV file Mydata.csv, with separator character as '@'.
Question 7Why do you need connection to an SQL database in order to get data from a table ?
Question 8What is pymysql library of Python ?
Question 9What all libraries do you require in order to interact with MySQL databases (and DataFrame) from within Python ?
Question 10What additional argument do you need to specify in to_sql() so that old data of MySQL table is retained ?
Question 11If query is a string storing an SQL statement. Write statements so that the data is fetched based on query from SQL database Mydata.
Question 1Predict the output of following code fragments one by one. For every next code fragment, consider that the changes by previous code...
Question 2Are the following two statements same ? Why/Why not ?(i) pd.read_csv('zoo.csv', sep = ',')(ii) pd.read_csv('zoo.csv')
Question 3How are following two codes similar or different ? What output will they produce ?(i)df = pd.read_csv("data.csv", nrows = 5) print(df)...
Question 4Write Python statement to export the DataFrame to a CSV file named data.csv stored at D: drive.
Question 5What is the difference between following two statements ?(i)df.to_sql('houses', con = conn, if_exists = 'replace') (ii)df.to_sql('houses',...
Question 6Consider following code when conn is the name of established connection to MySQL database.Cars = {'Brand': ['Alto', 'Zen', 'City', 'Kia'],...
Question 7Consider following code when conn is the name of established connection to MySQL database.sql = SELECT * from Sales where zone = "central";...
Question 1Write a program to read details such as Item, Sales made in a DataFrame and then store this data in a CSV file.Solutionimport pandas as pd...
Question 2Write a program to read data from a CSV file where separator character is '@'. Make sure that :the top row is used as data, not as column...
Question 3Write a program to get following data in two DataFrames :df 1:Roll noName1ABC2DEFdf2:Roll noMarks 1Marks 2Marks 317080752606570Store these...
Question 4You have a database on MySQL namely school having three tables in it — Student, Subject, Teacher. Write a program to store these tables in...
Question 5The DataFrame SDF stores the sales records of 100 salesmen. Write a program to store this as a table in database namely "company" on...
Question 6Consider the SDF DataFrame storing the sales records of 100 salesmen. Write a program that stores only the first 25 rows of the DataFrame...
Question 7The sales table of company database of MySQL stores the sales records of 100 salesmen. Write a program to load only those records in...