# Data Handling using Pandas – I Class 12 Informatics Practices Important Questions

Students can read the important questions given below for Data Handling using Pandas – I Class 12 Informatics Practices. All Data Handling using Pandas – I Class 12 Notes and questions with solutions have been prepared based on the latest syllabus and examination guidelines issued by CBSE, NCERT and KVS. You should read all notes provided by us and Class 12 Informatics Practices Important Questions provided for all chapters to get better marks in examinations. Informatics Practices Question Bank Class 12 is available on our website for free download in PDF.

## Important Questions of Data Handling using Pandas – I Class 12

Question: Write import Statement for Pandas Module
Answer: import pandas as pd

Question: Difference between a list and a series.
Answer: In Lists, index value can not be changed eg. [10, ‘Hello’, True]
In Series, index value can be changed.
s2 = pd.Series([‘Hello’, 10, True], index=[2,1,3])
2 Hello
1 10
3 True

Question: How many Data Structures available in Pandas?
Answer: Two Data Structures available in Pandas
1. Data Series / Series 2. Data Frame

Question: Create a series which contains 5 numbers and alphabets as index.
Answer: import pandas as pd
s = pd.Series([1,2,3,4,5],index = [‘a’,’b’,’c’,’d’,’e’])

Question: Create a series and multiply every element by 2
Answer: import pandas as pd
s = pd.Series([1,2,3,4,5])
print(s*2)

Question: Create a series which contains names of person.
Answer: import pandas as pd
s=pd.Series([‘suman’,’ravi’,’swati’])
print(s)

Question: Create an empty series.
Answer: import pandas as pd
s=pd.Series()
print(s)

Question: What will be output of the following:
s = pd.Series([1,2,3,4,5])
s.size
Answer: 5 # s.size gives numbers of elements

Question: Create a series from dictionary.
Answer: import pandas as pd
data = {‘a’ : 0., ‘b’ : 1., ‘c’ : 2.}
s = pd.Series(data)
print(s)

Question: What will be output of the following:
s = pd.Series([1,2,3,4,5])
s.ndim
Answer: 1 # ndim gives the dimension of series

Question: __________________ function returns first n rows from the object based on position.

Question: __________________ function returns last n rows from the object based on position.

Question: CSV stands for ________________________________________
Answer: Comma separated values.

Question:_______________Return the sum over requested axis in Data Frame Df.

Question:__________________Return the minimum over requested axis in Data Frame Df.

Question: Predict the Output:
import pandas as pd
L=[[‘Rahul’,17],[‘Mohit’,18]]
Df=pd.DataFrame(L, columns=[‘Name’,’Age’])
print(Df)
0          Rahul          17
1          Mohit           18

Question: _____________ is used to check the Null values in a Data Frame.
Answer: isnull ( )

Question: Which of the following is used to replace Null values in a Data Frame?
Answer: fillna ( )

Question: What does DataFrame df.columns give?
Answer: Shows the columns name of Data Frame df.

Question: Axis=1 in a Data Frame represents.

Question: Axis=0 in a Data Frame represents
Rows

Question: The file extension of a csv file is _________________

Question: The library to be imported to export and import DataFrame to and from a csv file is_____________
pandas

Question: CSV stands for ________________________________________
Answer: Comma separated values.

Question: By default a csv file opens with __________________

Question: Study the following program, then write the output if we open the file ‘file1.csv’ in excel.
import pandas as pd
d={‘designation’:[‘manager’,’clerk’,’salesman’, ‘director’]
,’salary’:[25000,15000,14000,30000]}
df=pd.DataFrame(d)
df.to_csv(‘file1.csv’)

Question: Study the following program, then write the output if we open the file ‘file1.csv’ in excel.
import pandas as pd
d={‘designation’:[‘manager’,’clerk’,’salesman’,’director’]
,’salary’:[20000,15000,22000,30000]}
df=pd.DataFrame(d)
df.to_csv(‘file1.csv’, index=False)

Question: Write a python program to export the DataFrame ‘df1’ to a csv file ‘file1.csv’ in the current folder.
Answer: import pandas as pd
df1.to_csv(‘file1.csv’)

Question: Write a python program to export the DataFrame ‘df1’ to a csv file ‘file1.csv’ in ‘mycsv’ folder under ‘D’ drive.
Answer: import pandas as pd
df1.to_csv(‘d:/mycsv/file1.csv’)

Question: Write a python program to export the DataFrame ‘df1’ to a csv file ‘file1.csv’ in ‘mycsv’ folder under ‘D’ drive without index of the Dataframe.
Answer: import pandas as pd
df1.to_csv(‘d:/mycsv/file1.csv’, index=False)

Question: Write a python program to export the DataFrame ‘df1’ to a csv file ‘file1.csv’ in the current folder without index of the Dataframe.
Answer: import pandas as pd
df1.to_csv(‘file1.csv’, index=False)