Remove a dependency from a third-party code.
Use np.mean instead of a custom function.