What is the correct syntax to return both the first row and the second
row in a Pandas DataFrame df?
(A) df.loc[[0,1]] (B) df.[[0,1]]
(C) df.loc[[0-1]] (D) df.[[0-1]]
Answers
Answered by
2
Answer:
Option A: df.loc[[0,1]]
Answered by
0
Answer:
The correct answer is Option (A) i.e. df.loc[(0,1)]
Explanation:
Pandas is one of the most popular python library that is used for data analysis, and data manipulation.
It provide two structures for manipulating the data.
- Either by using series
- Or by using dataframes
Here the question asked is based on using dataframes for selecting the first and second row of dataframe.
The correct syntax for using the dataframe is specified in the option(A)
#SPJ3
Similar questions