Informatics Practices
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.
Python Data Handling
2 Likes
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
When creating a Series using scalar values, we must provide an index. This is because a Series requires an index to associate with each value. This scalar value shall be repeated to match the length of the index.
Answered By
1 Like
Related Questions
Assertion (A): A series stores data row-wise.
Reasoning (R): A series is a one-dimensional labelled data structure.
- 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. 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): 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.
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.