pandasquiz
pandasquiz
Marked Answer :
98102
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
1134
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
0
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
No
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
510
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
What is the lowest price of the house?
Marked Answer :
75000
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
98053
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
Series data type
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
What value will you get on the left side after printing a series format data?
Marked Answer :
Index
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
In what format the keys will get converted into when we convert the dictionary data
into
data frame format?
Marked Answer :
Column
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
data.apply(your_function_name(arg1))
Total Marks :1MARKS OBTAINED0
===================================================================================
============================
===================================================================================
============================
Marked Answer :
Both A & C
Total Marks :1MARKS OBTAINED0
===================================================================================
============================
===================================================================================
============================
Which of the following syntax will display the last two records of df?
import pandas as pd
df = pd.DataFrame({‘A’:[34, 78, 54], ‘B’:[12, 67, 43]}, index=[‘r1’, ‘r2’, ‘r3’])
Marked Answer :
df.loc[‘r2′:’r3’]
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
All of the above
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Which of the following is the correct syntax for getting the houses where no. of
bedrooms is maximum having 3 views along with 1 waterfront?
Marked Answer :
housing[(housing[“bedrooms”]==housing[“bedrooms”].max()) & (housing[“view”]==3) &
(housing[“waterfront”]==1)]
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
data.loc[(data[“yr_built”] < 1980) & (data['floors'] > 2) & (data[‘bedrooms’] > 2)]
===================================================================================
============================
===================================================================================
============================
[‘Martha’, 25],
[‘Calvin’, 12],
[‘Stuart’, 15]
The resulting dataframe must contain the column names as ‘Name’, and ‘Age’ with the
Marked Answer :
pd.DataFrame(sample_list, columns=[‘Name’, ‘Age’])
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
For a given dictionary, convert the same into a dataframe.
sample_dict = {‘Cristiano’: [‘Ronaldo’,’Man U’, 801],
‘Lionel’: [‘Messi’,’PSG’, 758],
‘Luis’: [‘Suarez’,’Atletico Madrid’, 509],
‘Robert’: [‘Lewandowski’,’Bayern Munich’, 527],
‘Zlatan’: [‘Ibrahimovic’,’AC Milan’,553]
}
Marked Answer :
df1 = pd.DataFrame(sample_dict) df1 = df1.transpose() df1.reset_index(inplace =
True) df1.columns = [‘First Name’,’Last Name’, ‘Club’, ‘Goals’]
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
pd.DataFrame(sample_tuple, columns=[‘Number’, ‘Number_text’, ‘txtlen’])
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
ascending = housing.sort_values(‘price’, ascending=True) descending =
housing.sort_values(‘price’, ascending=False)
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Calculate the mean and standard deviation of all the numerical values in the
dataset. For
example – the mean for the bedrooms column is 3.370 and the standard deviation is
0.930.
Marked Answer :
housing.describe()
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
Marked Answer :
data[‘Floor Area’] = data[‘sqft_living’], data[‘sqft_lot’], data[‘sqft_basement’],
data[‘sqft_above’]
Total Marks :1MARKS OBTAINED0
===================================================================================
============================
===================================================================================
============================
Marked Answer :
inner = pd.merge(A, B, on=’Age’, how=’inner’) outer = pd.merge(A, B, on=’Age’,
how=’outer’) left_outer = pd.merge(A, B, on=’Age’, how=’left’) right_outer =
pd.merge(A, B, on=’Age’, how=’right’)
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
What will be the correlation between the columns sqft_living and sqft_above?
Marked Answer :
0.876597
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================
If the correlation between the columns bathrooms and sqft_living is 0.754665, what
all
interpretations can be made about the two columns?
Marked Answer :
A positive correlation between the two columns
Total Marks :1MARKS OBTAINED1
===================================================================================
============================
===================================================================================
============================