WorksheetsPython pandas
Total questions: 35
Worksheet time: 18mins
Pandas deals with following data structures
Series
Series and Data Frames
Series, DataFrames and Panel
None of Above
Best way to import the pandas module in your program ?
1.import pandas
2.import pandas as pd
3.from pandas import *
4.All of the above
DataFrame in pandas is
1. dimensional array
2. dimensional array
3.dimensional array
4.None of the above
All pandas data structures are ___ mutable but not always _______mutable.
a) size, value
b) semantic, size
c) value, size
d) none of the mentioned
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
Full form of CSV file is
Comma Separated Vault
Comma Separated Value
Common Separated Value
Common System Value
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 is the correct Pandas syntax to read in a csv file and assign it to a DataFrame df?
df = read_csv('file.csv')
df = read('file.csv', type = 'csv')
df = pd.read_csv('file.csv')
df = with open('file.csv') as pd.DataFrame
Type the syntax that returns the top 5 rows in DataFrame df with the native Pandas function (not slicing):
(a)
Among the following functions, which one can be used to combine dataframes when they have similar structure.
combine_first
concat()
merge()
For the concat(), if the axis=1, it will join the dataframes ...............
vertically
horizontally
Which function can be used to combine dataframes based on common fields?
merge()
combine_first()
concat()
Which function views dataframe in the form of vertical subset ie column wise?
iterrows()
iteritems()
Series.tail(3) will return how many values.
3 values from front
3 values from last
5 values
none
Series.head() will return how many rows.
2
3
4
5
To extract subset from Series,the following function is used
row()
column()
loc()
all
Series can be created from
Array
Dictionary
Scatter value
All of them
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
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 pd1
s = pd1.Series([1,2,3])
t = pd1.Series([1,2,4])
u=s-t
print (u)
0 1
1 0
2 1
dtype: int64
0 0
1 0
2 1
dtype: int64
0 0
1 0
2 -1
dtype: float64
0 0
1 0
2 -1
dtype: int64
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
write the output:
import pandas as pd
s=pd.Series([1,2,3,4],index=['a','b','c','d'])
print(s.loc['b':'d'])
b 2
c 3
d 4
dtype: float64
b 2
c 3
d 4
dtype: object
c 3
d 4
dtype: int64
b 2
c 3
d 4
dtype: int64
Who is the main author of pandas?
Karl pearson
Wes McKinney
J D Hunter
None of these
Given are two objects, a list object namely lst1 and a series object ser1, both are having similar values, i.e. 2,4,6,8. Find out the output produced by following statements:
(I) print (lst1*2)
(II) print (ser1*2)
(a)
which library we import if we want to draw chart
numpy
matplotlib
pandas
to add a title in the chart we use the function
title("title of the chart")
plt.title("title of the chart")
plt.title(title of the chart)
we use this function to get the average of array
avg()
average()
mean()
to get an element in data frame we use the function
get()
find()
loc()
Which of the following commands is used to install Pandas?
pip install python-pandas
pip install pandas
python install python
python install pandas
(a) is the most popular open source python library used for doing data analysis.
Missing data in panda series and dataframe can be filled with a (a) value.
To create a series object (a) method is used.
Given col_names = ['A', 'B', 'C', 'D'], set the column names of DataFrame df to col_names:
(a)
