0

# Matrix row totals

In this example : 1 The spaces between the averages are uneven (in expected values). 2.Ceiling function has been applied. https://code.sololearn.com/cPj3C3q7thFh/?ref=app How can we arrive at the expected value ?

3 Answers

+ 1

To note: not remotely good at math.
To get the total of a matrix/array/list simply sum the total of the output using `sum()`. For getting the analytical information on matrix/array/list you could also simply use the `statistics` library for example getting mean, median, and mode.
Also I don't understand your use of `del` as python has automatic garbage collection and unused variable are already scooped. variables could be initialized better via reassignment.
I would also implement numpy into your script since it good when working with large numbers, initialize a numpy array with numpy.array or numpy.empty for an empty matrix.
numpy documentation: https://numpy.org/devdocs/reference/
statistics documentation: https://docs.python.org/3/library/statistics.html

+ 1

Xander I. Tedder del is for iterating through the array / dataframe 1 row at a time. Can you format with sum.?

+ 1

Xander I. Tedder Check out https://code.sololearn.com/cFQXB9vh7yVL/?ref=app
Can you sugest some improvements ?