Series Mean and ArgMax
easypandas_basicsImplement series_mean_and_argmax(data).
data is a non-empty dict {label: numeric_value}.
Return a tuple (mean, label_of_max):
mean— arithmetic mean of all values as a Pythonfloat.label_of_max— the label (key) whose value is the largest. When multiple values tie, return the label that appears first indata.
series_mean_and_argmax({"a": 1, "b": 3, "c": 2}) # → (2.0, 'b')
Your solution
Edit series_mean_and_argmax and run the real pytest suite in your browser — no install required. Your code is saved locally.
Loading the Python runtime (first run only)…
Hints
Hint 1
Create a Series with pd.Series(data), then call .mean() and .idxmax() on it.
Hint 2
pd.Series preserves insertion order, so .idxmax() returns the label of the first maximum when there are ties.