Spaces:
Running
Running
Commit
Β·
2eb8d69
1
Parent(s):
237684f
data page added
Browse files- pages/04_data.py +181 -0
pages/04_data.py
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def main():
|
4 |
+
st.set_page_config(page_title="Data Demystified", page_icon="π", layout="wide")
|
5 |
+
|
6 |
+
# Custom CSS for better engagement
|
7 |
+
st.markdown("""
|
8 |
+
<style>
|
9 |
+
.highlight-box {
|
10 |
+
padding: 1rem;
|
11 |
+
border-radius: 10px;
|
12 |
+
background: #f0f2f6;
|
13 |
+
margin: 1rem 0;
|
14 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
15 |
+
}
|
16 |
+
.fun-fact {
|
17 |
+
color: #2e7d32;
|
18 |
+
font-weight: 500;
|
19 |
+
}
|
20 |
+
.emoji-header {
|
21 |
+
font-size: 2.5rem !important;
|
22 |
+
margin-bottom: 1rem;
|
23 |
+
}
|
24 |
+
</style>
|
25 |
+
""", unsafe_allow_html=True)
|
26 |
+
|
27 |
+
pages = {
|
28 |
+
"π Introduction": intro_page,
|
29 |
+
"π Data Types Overview": types_page,
|
30 |
+
"ποΈ Structured Data": structured_page,
|
31 |
+
"𧩠Semi-Structured Data": semi_structured_page,
|
32 |
+
"π¨ Unstructured Data": unstructured_page
|
33 |
+
}
|
34 |
+
|
35 |
+
with st.sidebar:
|
36 |
+
st.title("Navigation")
|
37 |
+
page = st.radio("Go to", list(pages.keys()))
|
38 |
+
|
39 |
+
pages[page]()
|
40 |
+
|
41 |
+
def intro_page():
|
42 |
+
st.markdown('<div class="emoji-header">π Welcome to Data Science Fundamentals</div>', unsafe_allow_html=True)
|
43 |
+
|
44 |
+
col1, col2 = st.columns([3, 2])
|
45 |
+
with col1:
|
46 |
+
st.write("""
|
47 |
+
### What is Data Science?
|
48 |
+
Data Science is the art of extracting meaningful insights from raw data -
|
49 |
+
like being a digital detective uncovering hidden patterns in the numbers!
|
50 |
+
|
51 |
+
**Did you know?** π€
|
52 |
+
<span class="fun-fact">Every day, we create 2.5 quintillion bytes of data -
|
53 |
+
that's equivalent to 250,000 Libraries of Congress!</span>
|
54 |
+
""", unsafe_allow_html=True)
|
55 |
+
|
56 |
+
st.markdown("""
|
57 |
+
### Why It Matters:
|
58 |
+
- Predict future trends π
|
59 |
+
- Solve complex problems π§©
|
60 |
+
- Power AI innovations π€
|
61 |
+
- Drive business decisions πΌ
|
62 |
+
""")
|
63 |
+
|
64 |
+
with col2:
|
65 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/64c972774515835c4dadd754/qpmLGi47ucDCWYEi8eZhE.png",
|
66 |
+
caption="Data is Everywhere!", width=300)
|
67 |
+
|
68 |
+
def types_page():
|
69 |
+
st.header("π¦ The Three Data Superheroes")
|
70 |
+
|
71 |
+
with st.expander("π Quick Comparison"):
|
72 |
+
st.table({
|
73 |
+
"Type": ["Structured", "Semi-Structured", "Unstructured"],
|
74 |
+
"Organization": ["Perfectly Organized", "Partially Organized", "Chaotic Creativity"],
|
75 |
+
"Examples": ["SQL Databases, Excel", "JSON, XML, CSV", "Images, Videos, Text"]
|
76 |
+
})
|
77 |
+
|
78 |
+
cols = st.columns(3)
|
79 |
+
data_types = [
|
80 |
+
("ποΈ Structured", "Neat rows & columns", "#e3f2fd"),
|
81 |
+
("𧩠Semi-Structured", "Flexible tags & markers", "#f0f4c3"),
|
82 |
+
("π¨ Unstructured", "Creative free-form", "#ffcdd2")
|
83 |
+
]
|
84 |
+
|
85 |
+
for col, (icon, desc, color) in zip(cols, data_types):
|
86 |
+
with col:
|
87 |
+
st.markdown(f"""
|
88 |
+
<div style="background: {color}; padding: 1rem; border-radius: 10px;">
|
89 |
+
<h3>{icon} {desc.split()[0]}</h3>
|
90 |
+
<p>{' '.join(desc.split()[1:])}</p>
|
91 |
+
</div>
|
92 |
+
""", unsafe_allow_html=True)
|
93 |
+
|
94 |
+
def structured_page():
|
95 |
+
st.header("ποΈ Structured Data: The Organized Perfectionist")
|
96 |
+
|
97 |
+
with st.container():
|
98 |
+
st.markdown("""
|
99 |
+
### Characteristics:
|
100 |
+
- Strict schema π
|
101 |
+
- Tabular format π
|
102 |
+
- Easy to query π
|
103 |
+
|
104 |
+
**Did you know?** π€
|
105 |
+
<span class="fun-fact">The first computerized database appeared in 1963 -
|
106 |
+
it weighed more than a car! ππΎ</span>
|
107 |
+
""", unsafe_allow_html=True)
|
108 |
+
|
109 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/64c972774515835c4dadd754/dSbyOXaQ6N_Kg2TLxgEyt.png",
|
110 |
+
width=400, caption="Structured Data Example")
|
111 |
+
|
112 |
+
with st.expander("π‘ Real-World Examples"):
|
113 |
+
st.markdown("""
|
114 |
+
- Financial records π°
|
115 |
+
- Inventory systems π¦
|
116 |
+
- Student databases π
|
117 |
+
- Railway timetables π
|
118 |
+
""")
|
119 |
+
|
120 |
+
def semi_structured_page():
|
121 |
+
st.header("𧩠Semi-Structured Data: The Flexible Friend")
|
122 |
+
|
123 |
+
with st.container():
|
124 |
+
st.markdown("""
|
125 |
+
### Why It's Special:
|
126 |
+
- Partial organization π
|
127 |
+
- Self-describing formats π
|
128 |
+
- Web-friendly π
|
129 |
+
|
130 |
+
**Did you know?** π€
|
131 |
+
<span class="fun-fact">JSON was created in 2001 -
|
132 |
+
the same year Wikipedia launched! ππ</span>
|
133 |
+
""", unsafe_allow_html=True)
|
134 |
+
|
135 |
+
cols = st.columns(2)
|
136 |
+
with cols[0]:
|
137 |
+
st.code("""
|
138 |
+
{
|
139 |
+
"name": "Data Hero",
|
140 |
+
"skills": ["JSON", "XML", "CSV"],
|
141 |
+
"mission": "Bring order to chaos!"
|
142 |
+
}
|
143 |
+
""", language="json")
|
144 |
+
|
145 |
+
with cols[1]:
|
146 |
+
st.markdown("""
|
147 |
+
### Common Formats:
|
148 |
+
- JSON (Web APIs) π
|
149 |
+
- XML (Document markup) π
|
150 |
+
- CSV (Spreadsheet data) π
|
151 |
+
- Email headers π§
|
152 |
+
""")
|
153 |
+
|
154 |
+
def unstructured_page():
|
155 |
+
st.header("π¨ Unstructured Data: The Creative Chaos")
|
156 |
+
|
157 |
+
with st.container():
|
158 |
+
st.markdown("""
|
159 |
+
### The Wild West of Data:
|
160 |
+
- No predefined format π¨
|
161 |
+
- Human-friendly formats π
|
162 |
+
- Requires AI processing π€
|
163 |
+
|
164 |
+
**Did you know?** π€
|
165 |
+
<span class="fun-fact">90% of all digital data is unstructured -
|
166 |
+
that's like having 1000 Netflix movies for every person on Earth! πΏπ</span>
|
167 |
+
""", unsafe_allow_html=True)
|
168 |
+
|
169 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/64c972774515835c4dadd754/xhaNBRanDaj8esumqo9hl.png",
|
170 |
+
width=400, caption="Unstructured Data in Action")
|
171 |
+
|
172 |
+
with st.expander("π Modern Applications"):
|
173 |
+
st.markdown("""
|
174 |
+
- Facial recognition systems π©π»
|
175 |
+
- Voice assistants π£οΈ
|
176 |
+
- Medical image analysis π₯
|
177 |
+
- Social media monitoring π±
|
178 |
+
""")
|
179 |
+
|
180 |
+
if __name__ == "__main__":
|
181 |
+
main()
|