Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 3 : 3.5 / 3.5
Advertisement
Detailed Solution
सही उत्तर 3.5 / 3.5 है।
Key Points
Helpful?
Question:
What does the following Python code print? import pandas as pd; df = pd.DataFrame({'G': ['a', 'a', 'b', 'b'], 'V': [1, 2, 3, 4]}); print(df.groupby('G')['V'].agg(['sum', 'mean']).loc['b', 'mean']) / निम्नलिखित Python कोड क्या प्रिंट करेगा?
1.
3 / 3
2.
7 / 7
3.
3.5 / 3.5
4.
2.5 / 2.5
Correct Answer: 3.5 / 3.5
Group 'b' contains the values 3 and 4; agg computes sum = 7 and mean = 3.5, and .loc['b', 'mean'] selects the mean of group 'b', which is 3.5. / समूह 'b' में मान 3 और 4 हैं; agg योग = 7 और माध्य = 3.5 परिकलित करता है, और .loc['b', 'mean'] समूह 'b' का माध्य चुनता है, जो 3.5 है।
Downloaded from PrepSnap (prepsnap.in)