Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1acba39

Browse files
Add files via upload
1 parent 30a59b5 commit 1acba39

File tree

2 files changed

+174
-0
lines changed

2 files changed

+174
-0
lines changed
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"name": "Measure_of_Center.ipynb",
7+
"version": "0.3.2",
8+
"provenance": []
9+
},
10+
"kernelspec": {
11+
"name": "python3",
12+
"display_name": "Python 3"
13+
}
14+
},
15+
"cells": [
16+
{
17+
"cell_type": "markdown",
18+
"metadata": {
19+
"id": "gmHVVuCdiHnl",
20+
"colab_type": "text"
21+
},
22+
"source": [
23+
"# Measure of Center\n",
24+
"\n",
25+
"---\n",
26+
"\n"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"metadata": {
32+
"id": "Cs6hAcU2h5NT",
33+
"colab_type": "code",
34+
"colab": {}
35+
},
36+
"source": [
37+
"import numpy as np\n",
38+
"x=[2,4,6,7,20,10,22]\n",
39+
"y=np.array(x)"
40+
],
41+
"execution_count": 0,
42+
"outputs": []
43+
},
44+
{
45+
"cell_type": "markdown",
46+
"metadata": {
47+
"id": "v0B8j5IsiDL7",
48+
"colab_type": "text"
49+
},
50+
"source": [
51+
"# Mean:\n",
52+
"\n",
53+
"---\n",
54+
"\n"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"metadata": {
60+
"id": "oYOWjwMviCLm",
61+
"colab_type": "code",
62+
"colab": {
63+
"base_uri": "https://localhost:8080/",
64+
"height": 34
65+
},
66+
"outputId": "1a7c27be-63e3-4423-cfad-da76e679bf10"
67+
},
68+
"source": [
69+
"print(\"Mean is : \",y.mean())"
70+
],
71+
"execution_count": 3,
72+
"outputs": [
73+
{
74+
"output_type": "stream",
75+
"text": [
76+
"Mean is : 10.142857142857142\n"
77+
],
78+
"name": "stdout"
79+
}
80+
]
81+
},
82+
{
83+
"cell_type": "markdown",
84+
"metadata": {
85+
"id": "0IpYCciHiQKX",
86+
"colab_type": "text"
87+
},
88+
"source": [
89+
"# Median:\n",
90+
"\n",
91+
"---\n",
92+
"\n"
93+
]
94+
},
95+
{
96+
"cell_type": "code",
97+
"metadata": {
98+
"id": "ZRjbvMUoiM9U",
99+
"colab_type": "code",
100+
"colab": {
101+
"base_uri": "https://localhost:8080/",
102+
"height": 34
103+
},
104+
"outputId": "4ee89fc5-f940-4595-afd3-d95b90ac2663"
105+
},
106+
"source": [
107+
"print(\"Median is : \",np.median(y))"
108+
],
109+
"execution_count": 4,
110+
"outputs": [
111+
{
112+
"output_type": "stream",
113+
"text": [
114+
"Median is : 7.0\n"
115+
],
116+
"name": "stdout"
117+
}
118+
]
119+
},
120+
{
121+
"cell_type": "markdown",
122+
"metadata": {
123+
"id": "Q3hBUZmEiYCh",
124+
"colab_type": "text"
125+
},
126+
"source": [
127+
"# Mode:\n",
128+
"\n",
129+
"---\n"
130+
]
131+
},
132+
{
133+
"cell_type": "code",
134+
"metadata": {
135+
"id": "k-wIC7j_iPdR",
136+
"colab_type": "code",
137+
"colab": {
138+
"base_uri": "https://localhost:8080/",
139+
"height": 34
140+
},
141+
"outputId": "1cb99ae2-a249-4b9a-ab13-f344cd7dc583"
142+
},
143+
"source": [
144+
"from statistics import mode\n",
145+
"print(\"Mode is:\",mode([1, 1, 2, 3, 3, 3, 3, 4]))"
146+
],
147+
"execution_count": 5,
148+
"outputs": [
149+
{
150+
"output_type": "stream",
151+
"text": [
152+
"Mode is: 3\n"
153+
],
154+
"name": "stdout"
155+
}
156+
]
157+
}
158+
]
159+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import numpy as np
2+
3+
x=[2,4,6,7,20,10,22]
4+
y=np.array(x)
5+
6+
print("Mean is : ",y.mean())
7+
8+
print("Median is : ",np.median(y))
9+
print("\n")
10+
print("Mean is : ",y.mean())
11+
12+
print("\n")
13+
14+
from statistics import mode
15+
print("Mode is:",mode([1, 1, 2, 3, 3, 3, 3, 4]))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /