DOMMETI commited on
Commit
34e4796
·
verified ·
1 Parent(s): d746236

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -0
app.py CHANGED
@@ -173,6 +173,60 @@ if numbers_input_2:
173
  else:
174
  st.write("No valid numbers provided.")
175
  st.subheader("Geometric Mean",divider=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  st.subheader("Harmonic Mean",divider=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
 
 
173
  else:
174
  st.write("No valid numbers provided.")
175
  st.subheader("Geometric Mean",divider=True)
176
+ st.markdown("""Geometric Mean is used on data which have \n * Multiplicative Data \n * Percentages and Rates \n * Normalized Data
177
+ """)
178
+ st.subheader("Geometric Mean for Population")
179
+ st.latex(r'''
180
+ \text{GM}_{\text{population}} = \left( \prod_{i=1}^{N} x_i \right)^{\frac{1}{N}}
181
+ ''')
182
+ st.subheader("Geometric Mean for Sample")
183
+ st.latex(r'''
184
+ \text{GM}_{\text{sample}} = \left( \prod_{i=1}^{n} x_i \right)^{\frac{1}{n}}
185
+ ''')
186
+ def geometric_mean(list1):
187
+ mul=reduce(lambda x,y: x*y,list1)
188
+ return round(mul**(1/len(list1)),2)
189
+ st.title("Calculate Arthamatic_Mean")
190
+ 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")
191
+ if numbers_input_3:
192
+ parts=numbers_input_3.split(",")
193
+ list1=[]
194
+ for i in parts:
195
+ i = i.strip()
196
+ if i.isdigit():
197
+ list1.append(int(i))
198
+ if list1:
199
+ result=arthamatic_mean(list1)
200
+ st.write("Geometric_Mean",result)
201
+ else:
202
+ st.write("No valid numbers provided.")
203
  st.subheader("Harmonic Mean",divider=True)
204
+ st.markdown("""Harmonic Mean is used on data which have \n * Rates and Ratios \n * \n * Data with Reciprocal Relationships
205
+ """)
206
+ st.subheader("Harmonic Mean for Population")
207
+ st.latex(r'''
208
+ \text{HM}_{\text{population}} = \frac{N}{\sum_{i=1}^{N} \frac{1}{x_i}}
209
+ ''')
210
+ st.subheader("Harmonic Mean for Sample")
211
+ st.latex(r'''
212
+ \text{HM}_{\text{sample}} = \frac{n}{\sum_{i=1}^{n} \frac{1}{x_i}}
213
+ ''')
214
+ def harmonic_mean(list1):
215
+ sum=reduce(lambda x,y: x+1/y,list1)
216
+ return round(len(list1)/sum,2)
217
+ st.title("Calculate Arthamatic_Mean")
218
+ 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")
219
+ if numbers_input_4:
220
+ parts=numbers_input_4.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=arthamatic_mean(list1)
228
+ st.write("Geometric_Mean",result)
229
+ else:
230
+ st.write("No valid numbers provided.")
231
 
232