print(S1[-1]) will return ___________ #’S1′ is a series
1. last element of series ‘S1’
2.first element of series ‘S1’
3.Key Error
4.all elements of series ‘S1’
Raman performed addition of series ‘S1’ and ‘S2’ and store the result in series ‘S3’. Both the series ‘S1’ and ‘S2’ have five mismatching index value. How many NaN will be there in ‘S3’?
1.2
2.3
3.4
4.5
S2 is ____________ in given code ? S2 = S1[2 : 5] #S1 is a Series object
1.List
2.Tuple
3.Series
4.All the above
Series ‘S1’ has five values with index value (0, 1, 2, 3, 4) and series ‘S2’ has five values with index (2, 3, 4, 5, 6). What will be the total number of values in ‘S3’ if S3 = S1 + S2
1.5
2.6
3.7
4.8
Sonal is a class XII student. She is learning “Series†in Python. She is confused in “parameter of Series( ) functionâ€. Help her to find the incorrect parameter.
1. data
2.index
3.number
4.dtype
What is the data type of series ‘S1’ given below ? S1=pd.Series([11, 12.5, “okâ€])
1.int64
2.float64
3.object
4.object64
When an operation is carried out on every value of Series object is called __
1.Scalar Operation
2.Vector Operation
3.Both of the above
4.None of the above
Which of the following function is used for basic mathematical operations in Series?
1. add( )
2.mul( )
3.div( )
4.All the above
Which of the following returns number of non-NaN values of Series?
1. count
2.size
3.index
4.values
Write the output of the following code : import pandas as pd S1=pd.Series([1,2,3,4]) S2=pd.Series([7,8]) S3=S1+S2 print(S3.size)
1.2
2.4
3.6
4.Error
>>> S1[1:3] = 50 will update the value of ___________ elements
1.1
2.2
3.3
4.4
Amit is working in an IT company. His boss asked him to prepare a chart in python. He is confused that which library will support plotting graph and data visualization in python. Help him to find the library
1.Pandas
2.Matplotlib
3.Numpy
4.Math
Amit is working in an IT firm as Data Manager. He stored the salary of all employees in Series named “Empserâ€. His Boss asked him to filter the employees whose salary is more than 20000. Help him to find the correct code. Sample of data stored is shown below. 0 25000 1 20000 2 21000 3 30000
1.print(Seremp > 20000)
2.print(Seremp (Seremp> 20000) )
3.print(Seremp [Seremp > 20000] )
4.print[Seremp> 20000]
An output of series ‘S1’ is shown below, are the data values in ‘S1 and _ are the data labels in ‘S1’. Output: Feb 2 Mar 3 Apr 4 dtype: int64
1.Month name, Numbers
2.Numbers, Month name
3.Month name, Month name
4.Numbers, Numbers
Anshuman wants to create a series named ‘S1’. He has written the following codes. His friend Shubham checked the code and said that one of the code given below is not working. As a friend of Anshuman, help him to find the incorrect code. a. S1=pd.Series(data=[11, 12, 5, 6,9],index=[1,2,3,4,5])
1.S1=pd.Series(data=[11, 12, 5, 6,9],index=[1,2,3,4,5])
2.S1=pd.Series([11, 12, 5, 6,9],index=[1,2,3,4,5])
3.S1=pd.Series([11, 12, 5, 6,9],[1,2,3,4,5])
4.S1=pd.Series(data=[11, 12, 5, 6,9], [1,2,3,4,5])
By default Series have _______ data labels starting from ___.
1.character, ‘a’
2.numeric, one
3.numeric, zero
4.character, zero
By using Matplotlib, we can generate __
1.Histograms
2.Bar charts
3.Scatterplots
4.All the above
Can a Series have duplicate index value?
1.yes
2.no
3.Yes, Only series with integer values
4.Yes, Only series with character values
Choose the correct statement : Statement1 : A Numpy array requires homogeneous data. Statement2 : Pandas DataFrame can have heterogeneous data.
1.Statement1 is correct
2.Statement2 is correct
3.Both the statements are correct
4.Both the statements are wrong
data’ in the following code could be _____ S1 = pd.Series(data)
1.Python sequence
2.Scalar value
3.Python dictionary
4.All the above
How many elements will be there in given series ‘S1’? import pandas as pd S1=pd.Series('python practice') print(S1)
1.0
2.1
3.2
4.15
How many times value ’10’ will be displayed in the given series ‘S1’? import pandas as pd S1=pd.Series(10, index = range(1, 10, 3)) print(S1)
1.1
2.3
3.5
4.4
How many values will be modified by last statement of given code ? import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['A', 'B', 'C', 'D']) S1['A' : 'C'] = 'ND'
1.1
2.2
3.3
4.4
How many values will be modified by last statement of given code ? import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['A', 'B', 'C', 'D']) S1['A' : 'C'] = 'ND'
1.name
2. index.name
3. size
4.Series.name
Installing Pandas is very similar to installing __
1.Microsoft Word
2.Numpy
3.Python
4.MySQL
Mathematical Operations on two Series object is done by matching ______
1.indexes
2.values
3.Both of the above
4.None of the above
Mr. Kumar is working in an IT company. He stored the salaries of all the employees of January month in Series ‘Jan_Sal’ and salaries of February month in Series ‘Feb_Sal’. Now he wants to add the salaries of both months. He has written the following statement. Identify the correct one.
1.print(Feb_Sal + Jan_Sal)
2.print(Feb_Sal_add_Jan_Sal)
3.print(Feb_Sal plus Jan_Sal)
4.None of the above
Number of students in each section of class 9th is stored in series ‘S1’. Write a statement to change the value of section ‘A’ and ‘B’ to 50. A 41 B 44 C 40 D 42 E 47
1. S1[ : 2] = 50 b.
2.S1[0 : 2] = 50
3.Both of the above
4.None of the above
Pandas DataFrame is size ________ and value ____
1.Mutable, Mutable
2.Immutable, Immutable
3.Immutable, Mutable
4.Mutable, Immutable
Pandas is the ____ library.
1.Freeware
2.Proprietary
3.Open source
4.End source
Pandas Series is size __________ and value _____
1.Mutable, Mutable
2.Immutable, Immutable
3.Immutable, Mutable
4.Mutable, Immutable
Python libraries contain a collection of built-in __
1.Data
2.Modules
3.Packages
4.Data Structure
Roshan has written few points about iloc( ) function of Series in Python. His friend Suman told that one of the written statement is not correct. Help him to find the incorrect statement.
1. In iloc( ) method, we have to pass an integer index.
2.This method include the last element of the range passed.
3.S1.iloc[3] will display fourth value of Series ‘S1’
4.S1.iloc[:3] will display first three values of Series ‘S1’
Rosy wants to display the series ‘S1’ in reverse order. Help her to find the correct code.
1.>>> S1[ : : 1]
2.>>> S1[ : : -1]
3. >>> S1[ -1 : :]
4.>>> S1[ : 1 1]
S1.values will return all the values of Series ‘S1’ in ___
1. Tuple
2.Dictionary
3.List
4.String
S1[0 : 2] = 50
1. last, first
2. first, second
3.last, seven
4. first, last
Two common ways for accessing the elements of a series are _________ and ____
1.Indexing, Concatenation
2. Labelled Indexing, Positional Indexing
3.Indexing, Slicing
4. Slicing, Cutting
We can access elements in Series by using ________ index and ____________index.
1.Numeric, labelled
2.Positional, Naming
3.Positional, labelled
4.None of the above
We can perform _____________ on two series in Pandas.
1.Addition
2.Subtraction
3.Multiplication
4.All the above
What is the data type of given series ‘S1’? import pandas as pd S1=pd.Series('a', index=(2.0, 3.0, 4.0, 5.0)) print(S1)
1.float64
2.int64
3.object
4.string
What is the index value of 31 in given Series ‘S1’? import pandas as pd S1=pd.Series([1,2,31,4], index = ['a','b','c','d'])
1.‘c’
2.2
3.Both of the above
4.None of the above
What is the index value of “Ravi†in the following Series? import pandas as pd S1 = pd.Series["Ram", "Raju", "Ravi", "Ramesh", "Rishabh"]
1.0
2.1
3.2
4.3
What type of error is returned, when the length of index and the length of data in Series() function is not same?
1.Key Error
2.Value Error
3.Syntax Error
4.Name Error
Which of the following are valid operations on Series ‘S1’?
1.>>> S1 + 2
2.>>> S1 ** 2
3.>>> S1 * 2
4.All the above
Which of the following attribute is used to check NaN value in Series?
1. hasNans
2.hasnans
3.Hasnans
4.HasNans
Which of the following attribute of Series is used to set the name of Series object?
1.size
2.name
3.index.name
4.values
Which of the following attribute of Series returns the tuple?
1.size
2.shape
3.values
4.index
Which of the following attributes returns all the values of Series?
1.size
2.index
3.name
4.values
Which of the following attributes returns True if there is no value in Series?
1.index
2.size
3.empty
4.values
Which of the following fills the missing values in Series? a.
1.fill value
2.fill-value
3.fill_value
4.fill_value( )
Which of the following is a high level data manipulation tool used for analyzing data.?
1.Nump
2.Pandas
3.Matplotlib
4.Math
Which of the following is parameter of Series( ) function?
1.data
2.index
3.dtype
4.All the above
Which of the following library help to visualize data?
1.Pandas
2.Numpy
3.Matplotlib
4.Random
Which of the following method is used to add two series?
1. sum( )
2.addition( )
3.add( )
4.None of the above
Which of the following method is used to subtract the two series?
1.subtract( )
2.subtraction( )
3.diff( )
4.sub( )
Which of the following property/attribute return total number of values in Series ‘S1’?
1.size
2.values
3.index
4.None of the above
Which of the following statement is correct to add NaN value in series?
1.S1=pd.Series([10, np.NaN,11])
2.S1=pd.Series([10, None, 11])
3.Both of the above
4.None of the above
Which of the following statement is replacing missing values of Series A and Series B by 100 .
1. >>> A.add(B, fill_value = 100)
2.>>>A.add(B, fill_value : 100)
3.>>> A.add(B, fill-value = 100)
4.>>> A.add(B, fill-value = 100)
Which of the following statement return Boolean result? import pandas as pd S1=pd.Series([11, 12, 5, 6,9]) print(S1) #Statement 1 print(S1>7) #Statement 2 print(S1[S1>7]) #Statement 3
1.Statement 1
2.Statement 2
3.Statement 3
4.None of the above
Which of the following statement return Filtered result? import pandas as pd S1=pd.Series([11, 12, 5, 6,9]) print(S1) #Statement 1 print(S1>7) #Statement 2 print(S1[S1>7]) #Statement 3
1.Statement 1
2.Statement 2
3.Statement 3
4.None of the above
Which of the following statement shows first five values of Series ‘S1’?
1. S1.head( )
2.S1.head( 5 )
3.Both of the above
4.None of the above
Which of the following statement will display the difference of two Series ‘A’ and ‘B’?
1.>>>A – B
2.>>>A.sub(B)
3.Both of the above
4.None of the above
Which of the following statement will display values more than 40 from Series ‘S1’?
1.>>>S1
2.>>> S1 > 40
3.>>>S1[S1 > 40]
4.None of the above
Which of the following statement will modify the first three values of Series ‘S1’?
1. S1[0, 1, 2] = 100
2.S1[0 : 3] = 100
3.S1[ : 3] = 100
4.All the above
Which of the following statement will print Series ‘S1’ in reverse order?
1.print(S1[: : 1]
2. print(S1[: : -1]
3.print(S1[-1: : 1]
4. print(S1.reverse( ))
Which of the following statement will return 10 values from the bottom/end of the Series ‘S1’?
1.S1.tail( )
2.S1.tail(10)
3.S1.head(10)
4.S1(10)
While performing mathematical operations on series, index matching is implemented and all missing values are filled in with ___________ by default
1.NaN
2.None
3.0
4.1
Write a statement to display 12.5 as output using positional indexing. import pandas as pd S1=pd.Series([11, 12.5, None, 6], index=["J","F","M","A"])
1. print(S1[1])
2.print(S1[“Jâ€])
3.print(S1[0])
4.print(S1[“Fâ€])
Write a statement to import pandas with alias name ‘pds’
1.import pandas as pds
2.Import pandas as pds
3. import panda as pds
4.import Pandas as pds
Write the output of the following : import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['India', 'USA', 'UK', 'France']) print(S1['India', 'UK'])
1.India NewDelhi UK London dtype: object
2.India NewDelhi UK Washington dtype: object
3.Error
4.None of the above
Write the output of the following : import pandas as pd S1=pd.Series([1,2,3,4]) S2=pd.Series([7,8,9,10]) S2.index=['a','b','c','d'] print((S1+S2).count())
1.8
2.6
3.0
4.6
Write the output of the following : import pandas as pd S1=pd.Series([1,2,3,4]) S2=pd.Series([7,8]) print((S1+S2).count())
1.6
2.4
3.2
4.0
Write the output of the following code: import pandas as pd S1=pd.Series() print(pd.Series().empty)
1.True
2.False
3.Error
4.None of the above
Write the output of the following: import pandas as pd S1=pd.Series(data=[11, 12, None, 6,9,7],index=[1,12,3,4,2,4]) print(S1.count())
1.4
2.6
3.5
4.Error
Write the statement to get NewDelhi as output using positional index. import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['India', 'USA', 'UK', 'France'])
1.print(S1[0])
2. print(S1[‘India’])
3.Both of the above
4.print(S1.India)
_________ function is used to sort a Series object on the basis of values.
1.sort.values( )
2.sort_values( )
3.sort_value( )
4. sort_Values
_________ statement will assigns a name to the Series ‘S1’.
1.>>> S1.name = “Emplâ€
2. >>> S1_name = “Emplâ€
3. >>> S1[name] = “Emplâ€
4.>>> S1.indexname = “Emplâ€