Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 3 : 2 [2, 3] / 2 [2, 3]
Advertisement
Detailed Solution
सही उत्तर 2 [2, 3] / 2 [2, 3] है।
Key Points
Helpful?
Question:
What does the following Python code print? import pandas as pd; a = pd.DataFrame({'id': [1, 2, 3], 'v': ['x', 'y', 'z']}); b = pd.DataFrame({'id': [2, 3, 4], 'w': [10, 20, 30]}); m = pd.merge(a, b, on='id', how='inner'); print(m.shape[0], list(m['id'])) / निम्नलिखित Python कोड क्या प्रिंट करेगा?
1.
3 [1, 2, 3] / 3 [1, 2, 3]
2.
4 [1, 2, 3, 4] / 4 [1, 2, 3, 4]
3.
2 [2, 3] / 2 [2, 3]
4.
2 [1, 2] / 2 [1, 2]
Correct Answer: 2 [2, 3] / 2 [2, 3]
An inner merge keeps only the key values present in both frames — ids 2 and 3 — so the merged frame has 2 rows with ids [2, 3]. / इनर मर्ज केवल दोनों फ्रेमों में मौजूद कुंजी मान रखता है — id 2 और 3 — अतः विलयित फ्रेम में id [2, 3] के साथ 2 पंक्तियाँ हैं।
Downloaded from PrepSnap (prepsnap.in)