Information Practices: Section A
Information Practices: Section A
Section A
1. A _________ is a two dimensional labeled data structure.
a. Series b.DataFrame c. List d. None
2. To delete a row, the parameter axis of function drop() is assigned the value.
a. 0 b.1 c.2 d.3
3. Which of the following is correct statement for creating empty series?(Assume that
pandas library is already import as pd)
a. ser=pd.Series(NaN) b. ser=pd.Series(None) c. ser=pd.series d.ser=pd.Series()
4.Which library is to be imported for creating DataFrame?
a. python b. pandas c. DataFrame d. random
5. The following code create DataFrame name ‘Df’ with ___________ columns.
Df.DataFrame([1,4,6,8,9])
a. 1 b. 2 c. 3 d.4
6. To display first three rows of series object ‘M’, you may write:
a. M.head() b. M.tail(3) c. M.head(3) d. M.Tail(3)
8. Assertion (A): To use the Pandas library in a Python program, one must import it.
Reasoning (R): The only alias name that can be used with the Pandas library is
pd.
13. Which of the following Python statements is used to import data from a CSV file
into a Pandas DataFrame (Note: pd is an alias for pandas)?
16.Which of the following can be used to specify the data while creating a
DataFrame? a.Series b. List of Dictionaries c.Structured ndarray d.
All of these
Section B
>>>import pandas as pd
>>>A=pd.Series(data=[35,45,55,40])
>>>print(A>45)
import pandas as pd
Year1={'Q1':5000,'Q2':8000,'Q3':12000,'Q4': 18000}
Year2={'A' :13000,'B':14000,'C':12000}
totSales={1:Year1,2:Year2}
df=pd.DataFrame(totSales)
print(df)
Or
import Pandas as pd
data =[D1,D2,D3
df =Pd.Dataframe (data)
print (df)
OR
B. Complete the given Python code to get the required output (ignore the dtype
attribute) as
Output:
Manipur Imphal
Code:
import __________ as pd
data=['Chennai’,’_________’,’ Imphal’]
print( __________ )
OR
Write a Python Program to create a Pandas Series as shown below using a
dictionary. Note that the left column indicates the indices and the right column
displays the data.
Russia Moscow
Hungary Budapest
Switerland Bern
Type Code
0 Fiction F
1 Non Fiction NF
2 Drama D
3 Poetry P
ii. Add a new genre of type 'Folk Tale' having code as "FT” and 600 number of
copies.
31. Write a python code to create series object using python sequence.
32. Write a python code to create the following series using numpy and dictionary
H1 54
H2 43
H3 87
H4 66
H5 59
Section D
33.Ekam, a Data Analyst with a multinational brand has designed the DataFrame If
that contains the four quarter's sales data of different stores as shown below:
data = {
df = pd.DataFrame(data)
R1 Jaya 14 98 cs
R2 Bala 17 78 bio
R3 Krish 15 68 pe
R4 sakthi 15 65 ip
R5 abi 13 87 cs
plt.xlabel('Overs')
plt.__________('Runs Scored')
plt.plot(x,y)
plt.____________()