Pandas Assignment 1
Pandas Assignment 1
11. Which of the following data types can a Pandas Series have?
A. Int
B. Str
C. Float
D. All of the above
13. What value will you get on the left side after printing a series format data?
A. Data
B. Value
C. Index
D. All of the above
15. In what format the keys will get converted into when we convert the dictionary data into
data frame format?
A. Rows
B. Columns
C. Indexes
D. Records
A. data.apply(your_function_name(arg1))
B. data.apply_fun(function_name())
C. data.app(data)
D. None of the above
18. Which of the following code will help to display the 3rd, 4th and 5th rows from the 6th to 9th
columns of data frame data?
A. data.loc[3:6, 6:10]
B. data.iloc[3;6,6;10]
C. data.iloc[3:6,6:10]
D. None of the above
19. Which of the following syntax will display the last two records of df?
import pandas as pd
A. df.iloc[:'r3']
B. df.loc['r2':'r3']
C. df.iloc['r2':'r3']
D. df.loc[:'r3']
20. Which of the following is/are true about loc in pandas:
21. Create a separate data frame that satisfies the conditions below.
1. Houses built before 1980
2. Have more than 2 bedrooms
3. Have more than 2 floors.
A. data.loc[(data["yr_built"] > 1980) & (data['floors'] > 2) & (data['bedrooms'] > 2)]
B. data.loc[(data["yr_built"] < 1980) & (data['floors'] > 2) & (data['bedrooms'] > 2)]
C. data.loc[(data["yr_built"] | 1980) & (data['floors'] > 2) | (data['bedrooms'] > 2)]
D. data.loc[(data["yr_built"] < 1980) | (data['floors'] > 2) | (data['bedrooms'] < 2)]
A. housing.describe()
B. housing.info()
C. housing.corr()
D. housing.std()
28. Create a new column with the floor area(sqft_living, sqft_lot, sqft_above,
sqft_basement, all combined in one column).
A. data['Floor Area'] = data['sqft_living'], data['sqft_lot'], data['sqft_basement'],
data['sqft_above']
B. df['Floor Area'] = data['sqft_living'] + data['sqft_lot'] + data['sqft_basement'] +
data['sqft_above']
C. data['Floor Area'] = data['sqft_living', 'sqft_lot','sqft_basement','sqft_above']
D. data['Floor Area'] = data['sqft_liv', 'sqft_lot','sqft_base','sqft_above']
30. What will be the correlation between the columns sqft_living and sqft_above?
A. 0.702035
B. 0.754665
C. 0.876597
D. 0.303093