Previous question · 1134
Rotate List
mediumData Structures
Next question · 1136
Combination Sum IV
mediumAlgorithms
Random coding question

1135. Mean aggregation

easy
GeneralGeneral
senior
Function contract
Inputs
rows
np.ndarray
value_idx
int
group_key_idx
int
Returns
value
np.ndarray

Examples

Input
{
  "rows": [
    [
      "u1",
      5
    ],
    [
      "u2",
      7
    ],
    [
      "u1",
      9
    ],
    [
      "u3",
      1
    ],
    [
      "u2",
      3
    ]
  ],
  "value_idx": 1,
  "group_key_idx": 0
}
Output
[
  [
    "u1",
    5,
    7
  ],
  [
    "u2",
    7,
    5
  ],
  [
    "u1",
    9,
    7
  ],
  [
    "u3",
    1,
    1
  ],
  [
    "u2",
    3,
    5
  ]
]

Constraints

Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Analytics Engineer
Companies
GeneralGeneral
Levels
senior
entry
Tags
groupby-aggregation
hash-map
feature-engineering
data-processing

Similar Questions

Linear Regressionmedium
ML Coding
Activation function relueasy
ML Coding
Text normalizationmedium
ML Coding
23 people are solving this problem
Loading editor for the selected language
Ln 1, Col 1
Program Output
DATAINTERVIEW
Interactive coding terminal
Python / NumPy environment ready.
Type a command below or run code from the editor.
run scriptExecute the current editor contents
submitGrade the current editor contents against all solution test cases
python ("print hello world")Run an isolated Python command
helpShow all available commands