Data Analysis with Python Projects - Mean-Variance-Standard Deviation Calculator

Tell us what’s happening:
I’ve typed in my entire code but when I press run, it says Replit: Package operation failed.
Your code so far

import numpy as np

def calculate(list):
  
  if not len(list) == 9:
    raise ValueError('List must contain nine numbers.')


  list = np.array(list)
  list = np.array(list).reshape(3,3)

  mean = (list.mean(0), list.mean(1), list.mean())
  mean = [array.tolist() for array in mean]

  var = (list.var(0), list.var(1), list.var())
  var = [array.tolist() for array in var]

  std = (list.std(0), list.std(1), list.std())
  std = [array.tolist() for array in std]

  max = (list.max(0), list.max(1), list.max())
  max = [array.tolist() for array in max]

  min = (list.min(0), list.min(1), list.min())
  min = [array.tolist() for array in min]
  
  sum = (list.sum(0), list.sum(1), list.sum())
  sum = [array.tolist() for array in sum]

  calculations = dict()
  calculations['mean'] = mean
  calculations['var'] = var
  calculations['standard deviation'] = std
  calculations['max'] = max
  calculations['min'] = min
  calculations['sum'] = sum

  return calculations

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Challenge: Data Analysis with Python Projects - Mean-Variance-Standard Deviation Calculator

Link to the challenge:

I fixed it by using an updated version of Numpy . I edited the numpy version in the poetry.lock and pyproject.toml packager files to (1.21.6) and (1.21) respectively.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.