Spaces:
Build error
Build error
Update pages/5_Measurement_of_Central_Tendency.py
Browse files
pages/5_Measurement_of_Central_Tendency.py
CHANGED
|
@@ -170,11 +170,11 @@ st.markdown("""Arthmetic Mean is used on data which have
|
|
| 170 |
<li>Data Without Outliers</li>
|
| 171 |
</ul>
|
| 172 |
""",unsafe_allow_html=True)
|
| 173 |
-
st.subheader("
|
| 174 |
st.latex(r'''
|
| 175 |
\mu = \frac{1}{N} \sum_{i=1}^{N} x_i
|
| 176 |
''')
|
| 177 |
-
st.subheader("
|
| 178 |
st.latex(r'''
|
| 179 |
\bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i
|
| 180 |
''')
|
|
@@ -195,3 +195,68 @@ if numbers_input_2:
|
|
| 195 |
st.write("Arthmetic_Mean",result)
|
| 196 |
else:
|
| 197 |
st.write("No valid numbers provided.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
<li>Data Without Outliers</li>
|
| 171 |
</ul>
|
| 172 |
""",unsafe_allow_html=True)
|
| 173 |
+
st.subheader("Arthmetic Mean for Population")
|
| 174 |
st.latex(r'''
|
| 175 |
\mu = \frac{1}{N} \sum_{i=1}^{N} x_i
|
| 176 |
''')
|
| 177 |
+
st.subheader("Arthmetic Mean for Sample")
|
| 178 |
st.latex(r'''
|
| 179 |
\bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i
|
| 180 |
''')
|
|
|
|
| 195 |
st.write("Arthmetic_Mean",result)
|
| 196 |
else:
|
| 197 |
st.write("No valid numbers provided.")
|
| 198 |
+
st.subheader("Geometric Mean")
|
| 199 |
+
st.markdown("""Geometric Mean is used on data which have
|
| 200 |
+
<ul class=icon-bullet>
|
| 201 |
+
<li>Multiplicative Data</li>
|
| 202 |
+
<li>Percentages and Rates</li>
|
| 203 |
+
<li>Normalized Data</li>
|
| 204 |
+
</ul>
|
| 205 |
+
""",unsafe_allow_html=True)
|
| 206 |
+
st.subheader("Geometric Mean for Population")
|
| 207 |
+
st.latex(r'''
|
| 208 |
+
\text{GM}_{\text{population}} = \left( \prod_{i=1}^{N} x_i \right)^{\frac{1}{N}}
|
| 209 |
+
''')
|
| 210 |
+
st.subheader("Geometric Mean for Sample")
|
| 211 |
+
st.latex(r'''
|
| 212 |
+
\text{GM}_{\text{sample}} = \left( \prod_{i=1}^{n} x_i \right)^{\frac{1}{n}}
|
| 213 |
+
''')
|
| 214 |
+
def geometric_mean(list1):
|
| 215 |
+
mul=reduce(lambda x,y: x*y,list1)
|
| 216 |
+
return round(mul**(1/len(list1)),2)
|
| 217 |
+
st.title("Calculate Geometric_Mean")
|
| 218 |
+
numbers_input_3 = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 3, 4, 5):", key="numbers_input_3")
|
| 219 |
+
if numbers_input_3:
|
| 220 |
+
parts=numbers_input_3.split(",")
|
| 221 |
+
list1=[]
|
| 222 |
+
for i in parts:
|
| 223 |
+
i = i.strip()
|
| 224 |
+
if i.isdigit():
|
| 225 |
+
list1.append(int(i))
|
| 226 |
+
if list1:
|
| 227 |
+
result=geometric_mean(list1)
|
| 228 |
+
st.write("Geometric_Mean",result)
|
| 229 |
+
else:
|
| 230 |
+
st.write("No valid numbers provided.")
|
| 231 |
+
st.subheader("Harmonic Mean")
|
| 232 |
+
st.markdown("""Harmonic Mean is used on data which have
|
| 233 |
+
<ul class=icon-bullet>
|
| 234 |
+
<li>Rates and Ratios</li>
|
| 235 |
+
<li>Data with Reciprocal Relationships</li>
|
| 236 |
+
</ul>
|
| 237 |
+
""",unsafe_allow_html=True)
|
| 238 |
+
st.subheader("Harmonic Mean for Population")
|
| 239 |
+
st.latex(r'''
|
| 240 |
+
\text{HM}_{\text{population}} = \frac{N}{\sum_{i=1}^{N} \frac{1}{x_i}}
|
| 241 |
+
''')
|
| 242 |
+
st.subheader("Harmonic Mean for Sample")
|
| 243 |
+
st.latex(r'''
|
| 244 |
+
\text{HM}_{\text{sample}} = \frac{n}{\sum_{i=1}^{n} \frac{1}{x_i}}
|
| 245 |
+
''')
|
| 246 |
+
def harmonic_mean(list1):
|
| 247 |
+
sum=reduce(lambda x,y: x+1/y,list1)
|
| 248 |
+
return round(len(list1)/sum,2)
|
| 249 |
+
st.title("Calculate Harmonic_Mean")
|
| 250 |
+
numbers_input_4 = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 3, 4, 5):", key="numbers_input_4")
|
| 251 |
+
if numbers_input_4:
|
| 252 |
+
parts=numbers_input_4.split(",")
|
| 253 |
+
list1=[]
|
| 254 |
+
for i in parts:
|
| 255 |
+
i = i.strip()
|
| 256 |
+
if i.isdigit():
|
| 257 |
+
list1.append(int(i))
|
| 258 |
+
if list1:
|
| 259 |
+
result=harmonic_mean(list1)
|
| 260 |
+
st.write("Geometric_Mean",result)
|
| 261 |
+
else:
|
| 262 |
+
st.write("No valid numbers provided.")
|