Please refer to Important Questions Table Creation and Data Manipulation CommandsData Transfer Between Files, SQL, Databases and DataFrames Class 11 Informatics Practices below. These questions and answers have been prepared based on the latest examination guidelines and NCERT book issued for Class 11 Informatics Practices for the current academic year. We have provided Important Questions for Class 11 Informatics Practices for all chapters here. Table Creation and Data Manipulation CommandsData Transfer Between Files, SQL, Databases and DataFrames is an important chapter in Class 11 Informatics Practices, following Important Questions and their solutions will help you to get more marks in examinations.
Table Creation and Data Manipulation CommandsData Transfer Between Files, SQL, Databases and DataFrames Class 11 Informatics Practices Important Questions
Very Short Answer Type Questions
Q.1 What all libraries do you require in order to bring data from CSV file into a dataframe?
Ans: Pandas and Sqlite3 Library
Q.2 You want to read data from a CSV file in a dataframe but you want to provide your owncolumn names to dataframe. What additional argument would you specify in read_csv( )?
Ans: names, for ex-
Q.3 Which argument would you give to read_csv( ) if you only want to read top 10 rows of data?
Ans: nrows, for ex-
Q.4 Write command to store data of dataframe mdf into a CSV file Mydata.csv, with separate character as „@‟.
Short Answer Type Questions
Q.1 What are advantages of CSV file formats?
- A Simple, compact and ubiquitous format for data storage.
- A common format for data interchange.
- It can be opened in popular spreadsheet packages like MS-Excel, Cal etc.
- Nearly all spradsheets and databases support import/export to csv format.
Q.2 By default, read_csv( ) uses the values of the first row as column headers in dataframes. Which argument will you give to ensure that the top/first row‟s data is used as data and not as column headers?
Ans: header=none, for ex- mdf=pd. read_csv(“D:\Mydata.csv”,header=none)
Q.3 Why do you need connection to an SQL database in order to get data from a table?
Ans: A connection works like a channel connecting Python and the databse file through which data can travel to and from SQL database.
Q.4 What is sqlite3 library of Python?
Ans: The sqlite3 library deals with communication with SQLite databases. Sqlite3 is by default bundled with Python.
Q.5 What all libraries do you require in order to interact with sqlite3 databases (and dataframe) from within Python?
Ans: Pandas and Sqlite3 Library
Q.6 What additional argument do you need to specify in to_sql( ) so that old data of SQL table is retained?
Ans: append for ex- df.to_sql(“metros”,conn, if_exists=”append”)
Q.7 If query is a string storing an SQL statement. Write statements so that the data is fetched based on query from SQL database Mydata.db.
Ans: df=pd.read_sql(“select * from stud”,conn)
Skill Based Questions
Q.1 WAP to read details such as item, sales made in a dataframe and then store this data in a CSV file.
Q.2 WAP to read data from a CSV file where separator character is „@‟. Make sure that:
-> The top row is used as data, not as column headers.
Q.3 WAP to input the details of a students through Python and put those values into student table of Mydata.db.