File size: 8,049 Bytes
6e91cc2
 
 
b1cdddf
689f245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798127d
 
 
15467f9
798127d
15467f9
 
aafb9e9
15467f9
 
 
 
 
 
 
798127d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import streamlit as st
import math
from functools import reduce
st.subheader("Measure Of Central Tendency",divider=True)
st.markdown("""The measure of central tendency is used to find the central average value of the data.The central tendency can be computed by 
useing three ways \n * Mode \n * Median \n * Mean""")
st.subheader("MODE",divider=True)
st.markdown("""Mode will be giving the centeral tendency based on most frequently occuring data.The major drawback of mode is its frequecy baised it 
mostly focus on the data which is occuring most times.Here in this mode we might come across some situation's like """)
st.markdown(''':violet[No_Mode] \n  Let's understand why this situation raises for example let's take list of numbers [1,2,3,4,5] here we don't have 
frequency of numbers repeating in this senario we will come accross No_Mode situaton.
''')
st.markdown(''':violet[Uni_Mode] \n  Let's understand why this situation raises for example let's take list of numbers [1,1,1,2,3,4,5]. here by 
checking the list it will tend to know that the frequency of number 1 is more and it returns the value 1 as output.
''')
st.markdown(''':violet[Bi_Mode] \n  Let's understand why this situation raises for example let's take list of numbers [1,1,2,2,3,4,5]. here by
checking the frequency in list we come across a situtaion where we will find two maximun frequecy repeated value hence the output will be Bi_Mode.
''')
st.markdown(''':violet[Tri_Mode] \n  Let's understand why this situation raises for example let's take list of numbers [1,1,2,2,3,3,4,5]. here by
checking the frequency in list we come across a situtaion where we will find three maximun frequecy repeated value hence the output will be Tri_Mode.
''')
st.markdown(''':violet[Multi_Mode] \n  Let's understand why this situation raises for example let's take list of numbers [1,1,2,2,3,3,4,4,5]. here by
checking the frequency in list we come across a situtaion where we will find more than three maximun frequecy repeated value hence the output will be Multi_Mode.
''')
st.title("Calculate Mode")
def mode(*args):
    list1 = list(args)
    dict1 = {}
    dict2 = {}
    set1 = set(list1)
    for j in set1:
        dict1[j] = list1.count(j)
    max_value = max(dict1.values())
    count = [key for key, value in dict1.items() if value == max_value]
    if max_value == 1:
        return 'no mode'
    elif len(count) == len(set1):
        return 'no mode'
    elif len(count) == 1:
        dict2[count[0]] = dict1.get(count[0])
        return dict2
    elif len(count) == 2:
        return 'bi mode'
    elif len(count) == 3:
        return 'tri mode'
    else:
        return 'multimode'
numbers_input = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 2, 3, 4):")

if numbers_input:
    try:
        list1 = list(map(int, numbers_input.split(',')))
        result = mode(*list1)
        st.write("Mode result:", result)
    except ValueError:
        st.write("Please enter a valid list of numbers separated by commas.")
st.subheader("Median",divider=True)
st.markdown("""Median will also be giving the central tendency.But the major drawback of median is it prior foucus will be on the central value.
In order to find the mean first we have to sort the give list and based on the length of the list the formula are changed""")
st.subheader("Median Formula for Odd Number of Observations")
st.latex(r'''
\text{Median} = X_{\left(\frac{n+1}{2}\right)}
''')
st.subheader("Median Formula for Even Number of Observations")
st.latex(r'''
\text{Median} = \frac{X_{\left(\frac{n}{2}\right)} + X_{\left(\frac{n}{2}+1\right)}}{2}
''')
def median(list1):
    list1.sort()
    length = len(list1)
    if length % 2 == 0:
        mid1 = length // 2 - 1
        mid2 = length // 2
        return (list1[mid1] + list1[mid2]) / 2
    else:
        mid = length // 2
        return list1[mid]
st.title("Calculate Median")
numbers_input_1 = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 3, 4, 5):", key="numbers_input_1")
if numbers_input_1:
    parts = numbers_input_1.split(',')
    list1 = []
    
    for num in parts:
        num = num.strip()  
        if num.isdigit():
            list1.append(int(num))

    if list1:  
        result = median(list1)
        st.write("Median result:", result)
    else:
        st.write("No valid numbers provided.")
st.subheader("Mean",divider=True)
st.markdown("""
Mean is one of the beautiful measurement of central tendency it invovles all the data present in it.The only drawback of mean is it is 
effected by outliers.Based on the data we will compute the mean in three types""")
st.subheader("Arthmetic Mean",divider=True)
st.markdown("""Arthmetic Mean is used on data which have \n * Interval and Ratio Data \n * Symmetric Distributions \n * Data Without Outliers
""")
st.subheader("Population Mean Formula")
st.latex(r'''
    \mu = \frac{1}{N} \sum_{i=1}^{N} x_i
''')
st.subheader("Sample Mean Formula")
st.latex(r'''
    \bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i
''')
def arthamatic_mean(list1):
  sum=reduce(lambda x,y: x+y,list1)
  return sum/len(list1)
st.title("Calculate Arthmetic_Mean")
numbers_input_2 = st.text_input("Enter a list of numbers separated by commas (e.g., 1, 2, 3, 4, 5):", key="numbers_input_2")
if numbers_input_2:
    parts=numbers_input_2.split(",")
    list1=[]
    for i in parts:
        i = i.strip()
        if i.isdigit():
            list1.append(int(i))
    if list1:
        result=arthamatic_mean(list1)
        st.write("Arthmetic_Mean",result)
    else:
        st.write("No valid numbers provided.")
st.subheader("Geometric Mean",divider=True)
st.markdown("""Geometric Mean is used on data which have \n * Multiplicative Data \n * Percentages and Rates \n * Normalized Data
""")
st.subheader("Geometric Mean for Population")
st.latex(r'''
    \text{GM}_{\text{population}} = \left( \prod_{i=1}^{N} x_i \right)^{\frac{1}{N}}
''')
st.subheader("Geometric Mean for Sample")
st.latex(r'''
    \text{GM}_{\text{sample}} = \left( \prod_{i=1}^{n} x_i \right)^{\frac{1}{n}}
''')
def geometric_mean(list1):
  mul=reduce(lambda x,y: x*y,list1)
  return round(mul**(1/len(list1)),2)
st.title("Calculate Geometric_Mean")
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")
if numbers_input_3:
    parts=numbers_input_3.split(",")
    list1=[]
    for i in parts:
        i = i.strip()
        if i.isdigit():
            list1.append(int(i))
    if list1:
        result=geometric_mean(list1)
        st.write("Geometric_Mean",result)
    else:
        st.write("No valid numbers provided.")
st.subheader("Harmonic Mean",divider=True)
st.markdown("""Harmonic Mean is used on data which have \n *  Rates and Ratios  \n *  Data with Reciprocal Relationships
""")
st.subheader("Harmonic Mean for Population")
st.latex(r'''
    \text{HM}_{\text{population}} = \frac{N}{\sum_{i=1}^{N} \frac{1}{x_i}}
''')
st.subheader("Harmonic Mean for Sample")
st.latex(r'''
    \text{HM}_{\text{sample}} = \frac{n}{\sum_{i=1}^{n} \frac{1}{x_i}}
''')
def harmonic_mean(list1):
  sum=reduce(lambda x,y: x+1/y,list1)
  return round(len(list1)/sum,2)
st.title("Calculate Harmonic_Mean")
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")
if numbers_input_4:
    parts=numbers_input_4.split(",")
    list1=[]
    for i in parts:
        i = i.strip()
        if i.isdigit():
            list1.append(int(i))
    if list1:
        result=harmonic_mean(list1)
        st.write("Geometric_Mean",result)
    else:
        st.write("No valid numbers provided.")

import streamlit as st
import os

# Exact path to your video file (adjust accordingly)
file_path = '/Users/rajbunny/Downloads/WhatsApp Video 2024-12-05 at 7.06.56 PM.mp4'

# Check if the file exists
if os.path.exists(file_path):
    # Display the video
    st.video(file_path)
    st.write("### Video Played Successfully!")
else:
    st.error(f"File not found at path: {file_path}")