DataLane

11. Mean ignoring NaN

mediumProNot started~8 minPythonImplement nanmean()

Asked in screens shaped like: Tesla, Google

Return the arithmetic mean after dropping NaN values, rounded to 2 decimals.

Examples

  • Example 1

    Input: { "x": [1, null, 3] }
    Output: 2

Constraints

  • At least one non-NaN value

Python editor

Loading Python engine…

Ctrl/Cmd + Enter submits

Run your code to see stdout.

Pro problem

Medium problems unlock with Pro

Easy pads stay free. Medium and hard SQL and Python problems — editor, tests, hints, and solutions — open after you upgrade to Pro or coaching.

See plansPractice free easy problems
↑↓ navigate openesc close