This Study Resource Was
This Study Resource Was
import pandas as pd
a 89.2
c 98.2
dtype: float64
c 98.2
a 89.2
dtype: float64
Which of the following argument is used to label the elements of a series? index
Which of the following attributre or argument used to set column names of a data
frame? columns
What is the output of the expression 'b' in s, where is s is the series defined
as shown below?
m
er as
s = pd.Series([89.2, 76.4, 98.2, 75.9], index=list('abcd')) True
co
eH w
Which of the following expressions are used to check if each element of a series
s is present in the list of elements [67, 32]. Series s is defined as shown
o.
below. rs e
ou urc
s = pd.Series([99, 32, 67],list('abc')) s.isin([67, 32])
Which of the following cannot be used to create a Data frame? not a list of
o
import pandas as pd
ed d
df = pd.DataFrame(data) (2,3)
import pandas as pd
Th
Which of the following expressions are used to check if each element of a series
s is present in the list of elements [67, 32]. Series s is defined as shown
below.
This study source was downloaded by 100000824981070 from CourseHero.com on 07-11-2021 19:16:31 GMT -05:00
https://www.coursehero.com/file/66534953/Python-pandastxt/
What is the shape of data frame df defined in below shown code?
import pandas as pd
Which of the following expression is used to add a new column 'C' to a data
frame df, with 3 rows df['C'] = [12, 98, 45]
What does the expression df.loc['r4'] = [67, 78] do for the data frame df,
defined below.
m
er as
Which of the following expression is used to delete the column, A from a data
co
frame named df del df['A']
eH w
Which of the following expression returns first two rows of df, defined below.
o.
import pandas as pd
rs e
ou urc
df = pd.DataFrame({'A':[34, 78, 54], 'B':[12, 67, 43]}, index=['r1', 'r2',
'r3']) Both df[:2] and df.iloc[:2]
o
aC s
v i y re
Which of the following expression returns second row of df, defined below.
import pandas
'r3']) df.iloc[1]
ar stu
Which of the following expression returns data of column B of data frame df,
defined below.
sh is
import pandas as pd
Th
Which of the following expression returns last two rows of df, defined below.
import pandas as pd
This study source was downloaded by 100000824981070 from CourseHero.com on 07-11-2021 19:16:31 GMT -05:00
https://www.coursehero.com/file/66534953/Python-pandastxt/
What does the expression df.loc['r4'] = [67, 78] do for the data frame df,
defined below.
Which of the following expression returns second row of df, defined below.
import pandas
Which of the following expression is used to delete the column, A from a data
frame named df del df['A']
-----------------------------------Quiz on I/O in
pandas-------------------------------------
m
specific columns as dates? parse_dates
er as
co
eH w
Which of the following method is used to read data from excel files ? read_excel
o.
rs e
State whether the following statement is True or False? read_csv method can read
ou urc
multiple columns of an input file as indexes. true
Which of the following method is used to write a data frame data to an output
csv file? to_csv
--------------------------------------------Quiz on
Indexing----------------------------------------
sh is
Which of the following method is used to convert a list of date like strings
Th
What is the length of DatetimeIndex object created with the below expression?
import pandas as pd
This study source was downloaded by 100000824981070 from CourseHero.com on 07-11-2021 19:16:31 GMT -05:00
https://www.coursehero.com/file/66534953/Python-pandastxt/
What does the expression d + pd.Timedelta('1 days 2 hours') do to DatetimeIndex
object d, defined below
------------------------------------------------Data
Cleaning-------------------------------
Which of the following method of pandas is used to check if each value is a null
or not? isnull
Which of the following argument values are allowed for method argument of
fillna? All
Which of the following method is used to fill null values with a deafult value?
m
fillna
er as
co
Which of the following method is used to eliminate rows with null values?
eH w
dropna
o.
By deafault, missing values in any data set are read as ........?
rs e nan
ou urc
--------------------------------------------Quiz on Data
Aggregation--------------------------------
o
What does the expression df.iloc[:, lambda x : [0,3]] do ? Given a data frane df
aC s
with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2', 'r3']. Selects Column
v i y re
Which of the following methods is used to group data of a data frame, based on a
specifc columns not aggregate groupby
ed d
data frane df with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2', 'r3'].
Filters the row labelled r3
Given a data frane df with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2',
'r3'], Which of the following expression filter those rows whose column B values
sh is
Given a data frane df with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2',
'r3'], Which of the following expression filter those rows whose column B values
are greater than 45 and column 'C' values are less than 30. df.loc[(df.B > 45) &
(df.C < 30)]
Consider a data frame df with 10 rows and index [ 'r1', 'r2', 'r3', 'row4',
'row5', 'row6', 'r7', 'r8', 'r9', 'row10']. What does the aggregate method shown
in below code do?
g = df.groupby(df.index.str.len())
g.aggregate({'A':len, 'B':np.sum}) Computes length of column A and Sum of
Column B values of each group
Given a data frane df with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2',
This study source was downloaded by 100000824981070 from CourseHero.com on 07-11-2021 19:16:31 GMT -05:00
https://www.coursehero.com/file/66534953/Python-pandastxt/
'r3'], Which of the following expression is used to extract columns 'C' and 'D'
df.loc[:, lambda x : x.columns.isin(['C', 'D'])]
Which of the following method can be applied on a groupby object to get the
group details groups
What does the expression df.iloc[:, lambda x : [0,3]] do ? Given a data frane df
with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2', 'r3']. Selects Column
'A' and 'D'
Consider a data frame df with 10 rows and index [ 'r1', 'r2', 'r3', 'row4',
'row5', 'row6', 'r7', 'r8', 'r9', 'row10']. How many rows are obtained after
executing the below expressions 9
Consider a data frame df with 10 rows and index [ 'r1', 'r2', 'r3', 'row4',
'row5', 'row6', 'r7', 'r8', 'r9', 'row10']. What does the expression g =
df.groupby(df.index.str.len()) do? Groups df based on lebgth of each index
m
value
er as
co
eH w
o.
---------------------------------Quiz on Data
rs e
Merging-----------------------------------
ou urc
Which of the following method is used to concatenate two or more dataframes?
concat
o
Which of the following are allowed values of argument how of merge method? all
Which of the following argument is used to ignore the index while concatenating
two date frames ignore_index
ed d
Which of the following argument is used to set the key to be used for merging
ar stu
Which argument is used to override the existing column names, while using concat
method keys
sh is
Th
This study source was downloaded by 100000824981070 from CourseHero.com on 07-11-2021 19:16:31 GMT -05:00
https://www.coursehero.com/file/66534953/Python-pandastxt/
Powered by TCPDF (www.tcpdf.org)