Font size
WorksheetsPython Numpy and Pandas
Total questions: 50
Worksheet time: 25mins
How to use numpy ?
import numpy as np
import pandas as pd
import pyplot as plt
Name the function used to create an array?
np.aray()
np.array()
Np.array()
np.arange()
np.arange(2,8,1) ----> what output will be produced?
2,3,4,5,6,7,8
2,3,4,5,6,7,8,9
2,3,4,5,6,7
2,4,6,8
names = np.array(["Reem" , "Salah" , "Haya" , "Maryam" , "Fatema"])
print(names([2,3,4]))
Mark the right output from the below options
[ 'Haya' 'Maryam' 'Fatema' ]
[ 'Maryam' 'Haya' 'Fatema' ]
[ 'Reem' 'Salah' 'Fatema' ]
[ 'Reem' 'Salah' 'Haya' ]
names = np.array(["Reem" , "Salah" , "Haya" , "Maryam" , "Fatema"])
names[2] = "Omar"
print([names])
Mark the right output from the below options
[ "Reem" , "Salah" , "Haya" , "Maryam" , "Fatema" ]
[ "Reem" , "Salah" , "Omar" , "Maryam" , "Fatema" ]
[ "Reem" , "Haya" , "Salah" , "Maryan" , "Fatema" ]
Each location of an element in an array is called ______________
Size
Length
Index
Element
One dimensional arrays are also known as _____________
Vectors
ndarray
Matrices
Subscript
A=np.array([1,2,3,4],dtype=np.float64)
What is the itemsize of array 'A'?
1
4
8
16
b=np.array([[1,2,3,4],[5,6,7,8],[10,11,12,13]])
Write the value of b[2,1].
3
6
10
11
We can do arithmetic operations in python list.
True
False
x=np.array([9,4,2,7])
y=x+5
[14 9 7 12]
[14,9 ,7, 12]
[13 8 6 12]
[13,8 ,6 ,12]
How we can find the type of numpy array in python?
dtype
typei
type
itype
what is the use of the zeros() function in Numpy array in python ?
To make a Matrix with first row 0
To make a Matrix with all element 0
To make a Matrix with all diagonal element 0
None of the above
What is the use of the size attribute in Numpy array in python ?
It find the direction
It find the shape
It finds the number of items
All of the above
Which of the following find the maximum number in the Numpy array?
max(array)
array.max()
array(max)
None of the above
x=np.array([10,20,30,40,50,60,70])
print(np.median(x))
Find the output
35
35.0
40
37.7
Numpy in the Python provides the
Function
Lambda function
Type casting
Array
What is a correct syntax to create a NumPy array?
np.createArray([1, 2, 3, 4, 5])
np.array([1, 2, 3, 4, 5])
np.object([1, 2, 3, 4, 5])
What is a correct syntax to print the numbers [3, 4, 5] from the array below:
arr = np.array([1,2,3,4,5,6,7])
print(arr[2:5])
print(arr[2:6])
print(arr[2:4])
print(arr[3:6])
Pandas deals with following data structures
Series
Series and Data Frames
Series, DataFrames and Panel
None of Above
DataFrame in pandas is
1. dimensional array
2. dimensional array
3.dimensional array
4.None of the above
Which of the following object you get after reading CSV file?
a) DataFrame
b) Character Vector
c) Panel
d) All of the mentioned
Which of the following library is similar to Pandas?
a) NumPy
b) RPy
c) SciPy
d) None of the mentioned
Series can be created from
Array
Dictionary
Scaler value
All of them
Full form of CSV file is
Comma Separated Vault
Comma Separated Value
Common Separated Value
Common System Value
Not a function of Dataframe
Head()
Tail()
loc()
multi()
Dataframe can contain multiple series
True
False
Which function from the options given below can read the dataset from a large text file?
read_json
read_pickle
read_hdf
read_csv
Which of the following can be used to make a Dataframe?
Series
DataFrame
Structured ndarray
All of the above
For the concat(), if the axis=1, it will join the dataframes ...............
vertically
horizontally
Which of the functions can be used to delete column/row from a DataFrame?
pop()
at()
drop()
iloc()
To extract subset from Series,the following function is used
row()
column()
loc()
all
Series in Pandas is
1 Dimensional Array
2 Dimensional array
3 Dimensional array
none of above
Minimum number of argument we require to pass in pandas series ?
0
1
2
3
In data science, which of the python library are more popular ?
numpy
pandas
django
none
Which package should be needed for series
Maths
Statistic
Pandas
Random
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
pandas is a:
Data Structure
Series
Dataframe
Library
Write the output for the following:
import pandas as pd1
s = pd1.Series(5, index=[0, 1, 2, 3])
print(s)
0 5
0 5
1 5
2 5
3 5
dtype: int64
1 5
2 5
2 5
4 5
dtype: int64
0 5
1 5
2 5
3 5
dtype: object
write the output:
import pandas as pd
s=pd.Series([1,2,3,4],index=['a','b','c','d'])
print(s.iloc[2:4])
b 2
c 3
d 4
dtype: int64
b 3
c 4
dtype: int64
c 3
d 4
dtype: int64
none of the above
Give the output of the following code:
>>>import pandas as pd
>>>dict1 = {'AR' : 100, 'VR' : 200, 'AI' : 300}
>>>ser = pd.Series(dict1)
>>>print(ser[1])
AR
100
VR
200
A series is a one-dimensional array which is labelled and can hold any data type.
True
False
Pandas is an open-source ________ Library?
Ruby
Javascript
Java
Python
What will be output for the following code?
import pandas as pd
s = pd.Series([1,2,3,4,5],index = ['a','b','c','d','e'])
print(s['a'])
1
2
3
4
5
Which of the following commands is used to install Pandas?
pip install python-pandas
pip install pandas
python install python
python install pandas
Which of the following statements is false?
Dataframe is size-mutable
Dataframe is values mutable
Dataframe is immutable
Dataframe is capable to hold multiple types of data.
Series is a one-dimensional labeled array capable of holding any data type.
true
false
What library in python is used for plotting graphs?
numpy
pandas
math
matplotlib
Series.head() will return how many rows.
2
3
4
5
What does this line of code do?
Returns unique values
Checks duplicates
Drops duplicates
Checks index duplicates
