Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 2 : The row labelled 'q' / 'q' लेबल वाली पंक्ति
Advertisement
Detailed Solution
सही उत्तर The row labelled 'q' / 'q' लेबल वाली पंक्ति है।
Key Points
Helpful?
Question:
A DataFrame df has the custom index ['p', 'q', 'r']. What does df.loc['q'] return? / एक DataFrame df का कस्टम इंडेक्स ['p', 'q', 'r'] है। df.loc['q'] क्या लौटाएगा?
1.
The second row by position / स्थिति के अनुसार दूसरी पंक्ति
2.
The row labelled 'q' / 'q' लेबल वाली पंक्ति
3.
The column named 'q' / 'q' नाम का कॉलम
4.
A KeyError / KeyError त्रुटि
Correct Answer: The row labelled 'q' / 'q' लेबल वाली पंक्ति
loc is label-based, so df.loc['q'] fetches the row whose index label is 'q', regardless of its position. Positional access is the job of iloc. / loc लेबल-आधारित है, अतः df.loc['q'] 'q' लेबल वाली पंक्ति देता है, चाहे उसकी स्थिति कुछ भी हो। स्थिति-आधारित पहुँच iloc का काम है।
Downloaded from PrepSnap (prepsnap.in)