Calculator of my given project

import numpy as np

list_1=[1,3,3]

a=np.array(list_1)

b=a.reshape(3,3)

#MEAN

c_mean=b.mean(axis=0).tolist()

d_mean=b.mean(axis=1).tolist()

e_mean=b.mean().tolist()

f_mean=[c_mean,d_mean,e_mean]

#VAR

c_var=b.var(axis=0).tolist()

d_var=b.var(axis=1).tolist()

e_var=b.var().tolist()

f_var=[c_var,d_var,e_var]

#STD

c_std=b.std(axis=0).tolist()

d_std=b.std(axis=1).tolist()

e_std=b.std().tolist()

f_std=[c_std,d_std,e_std]

#MAX

c_max=b.max(axis=0).tolist()

d_max=b.max(axis=1).tolist()

e_max=b.max().tolist()

f_max=[c_max,d_max,e_max]

#MIN

c_min=b.min(axis=0).tolist()

d_min=b.min(axis=1).tolist()

e_min=b.min().tolist()

f_min=[c_min,d_min,e_min]

#SUM

c_sum=b.sum(axis=0).tolist()

d_sum=b.sum(axis=1).tolist()

e_sum=b.sum().tolist()

f_sum=[c_sum,d_sum,e_sum]

calculations={ 'mean': f_mean,'variance': f_var,'standard deviation': f_std,'max': f_max,'min': f_min,'sum': f_sum }

print(calculations)

Welcome there,

Do you have a question? Without asking a question, or providing any context, it is difficult for us to help.

The more information you give us, the more likely we will be able to help.


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

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