Informatics Practices
Assertion (A): The shape attribute returns the number of rows and number of columns available in dataframe.
Reasoning (R): The shape attribute returns the values in the form of list.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python Data Handling
1 Like
Answer
A is true but R is false.
Explanation
The shape attribute of a Pandas DataFrame returns the number of rows and the number of columns in the DataFrame. The shape attribute returns the values in the form of tuple.
Answered By
3 Likes
Related Questions
Assertion. DataFrame has both a row and column index.
Reason. A DataFrame is a two-dimensional labelled data structure like a table of MySQL.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): While creating a series using scalar values, index must be provided.
Reasoning (R): The scalar value is repeated to match the length of index.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): After running the following code:
df = pd.DataFrame([11,46], index = ['True', 'False']) print(df[True])A key error will be produced.
Reasoning (R): Dataframe does not support Boolean Indexing.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): We can add a new column in an existing dataframe using .at or .loc methods.
Reasoning (R): When we reassign new values to an existing column in a dataframe, the previous values are overwritten.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.