Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 1 : 5 / 5

Advertisement

Detailed Solution

सही उत्तर 5 / 5 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What does the following Python code print? import pandas as pd; df = pd.DataFrame({'X': [1, 2, 3], 'Y': [4, 5, 6]}, index=['p', 'q', 'r']); print(df.loc['q', 'Y']) / निम्नलिखित Python कोड क्या प्रिंट करेगा?

1.
5 / 5
2.
2 / 2
3.
q / q
4.
KeyError / KeyError

Correct Answer: 5 / 5

df.loc['q', 'Y'] selects the row labelled 'q' and the column 'Y'; the value at their intersection is 5. / df.loc['q', 'Y'] 'q' लेबल वाली पंक्ति और 'Y' स्तंभ का चयन करता है; उनके प्रतिच्छेद पर मान 5 है।

Downloaded from PrepSnap (prepsnap.in)