Spaces:
Sleeping
Sleeping
Update pages/Types of Data.py
Browse files- pages/Types of Data.py +47 -371
pages/Types of Data.py
CHANGED
|
@@ -1,6 +1,15 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
st.markdown(
|
| 5 |
"""
|
| 6 |
<style>
|
|
@@ -15,429 +24,96 @@ st.markdown(
|
|
| 15 |
.css-1d391kg p, .css-1v0mbdj p {
|
| 16 |
color: #B0BEC5;
|
| 17 |
}
|
| 18 |
-
.css-1aumxhk .stSlider .st-dh{
|
| 19 |
-
background-color: #76FF03;
|
| 20 |
-
}
|
| 21 |
.stButton > button:hover {
|
| 22 |
background-color: #4CAF50;
|
| 23 |
color: white;
|
| 24 |
transform: scale(1.05);
|
| 25 |
}
|
| 26 |
-
.download-button button {
|
| 27 |
-
background-color: #FF4081;
|
| 28 |
-
color: white;
|
| 29 |
-
}
|
| 30 |
-
.download-button button:hover {
|
| 31 |
-
background-color: #F50057;
|
| 32 |
-
transform: scale(1.1);
|
| 33 |
-
}
|
| 34 |
</style>
|
| 35 |
""",
|
| 36 |
unsafe_allow_html=True,
|
| 37 |
)
|
| 38 |
|
| 39 |
-
|
|
|
|
| 40 |
|
|
|
|
| 41 |
st.sidebar.subheader("π Explore Data Types")
|
| 42 |
-
|
| 43 |
-
# Dropdown to select data type to learn about
|
| 44 |
data_type = st.sidebar.selectbox(
|
| 45 |
"Select a Type of Data:",
|
| 46 |
["Structured Data", "Unstructured Data", "Semi-Structured Data"]
|
| 47 |
)
|
| 48 |
|
| 49 |
-
#
|
| 50 |
if data_type == "Structured Data":
|
| 51 |
st.subheader("π Structured Data")
|
| 52 |
st.write("""
|
| 53 |
-
**Definition**: Structured data
|
| 54 |
-
It is highly organized, and each data point is placed into a defined structure.
|
| 55 |
""")
|
| 56 |
-
|
| 57 |
-
st.write("**Features**:")
|
| 58 |
st.markdown("""
|
| 59 |
-
|
| 60 |
-
-
|
| 61 |
-
-
|
|
|
|
| 62 |
""")
|
|
|
|
| 63 |
|
| 64 |
-
st.
|
| 65 |
-
st.markdown("""
|
| 66 |
-
1. **Excel Files** π
|
| 67 |
-
2. **MySQL Databases** πΎ
|
| 68 |
-
""")
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
# Buttons for Structured Data Examples
|
| 72 |
-
if st.button("Show Excel Files π"):
|
| 73 |
st.subheader("Excel Files")
|
| 74 |
st.write("""
|
| 75 |
-
Excel files store structured data in rows and columns
|
| 76 |
-
Excel is a widely used tool in business, finance, and data analytics.
|
| 77 |
""")
|
| 78 |
-
# In the Structured Data page, add the following for the Excel button:
|
| 79 |
-
st.subheader("Excel Files")
|
| 80 |
-
st.write("""
|
| 81 |
-
**Excel** is a spreadsheet application developed by Microsoft. It stores structured data in rows and columns,
|
| 82 |
-
making it ideal for data analysis, calculations, and visualization.
|
| 83 |
-
**Key Features of Excel:**
|
| 84 |
-
- Store, analyze, and visualize data in tabular format.
|
| 85 |
-
- Support for formulas, functions, and pivot tables for advanced data manipulation.
|
| 86 |
-
- Integration with other applications and databases.
|
| 87 |
-
- Support for multiple sheets in a single workbook.
|
| 88 |
-
**Common Extensions:**
|
| 89 |
-
- `.xlsx` (default format for modern Excel)
|
| 90 |
-
- `.xls` (older format for Excel)
|
| 91 |
-
- `.csv` (Comma-Separated Values, compatible with Excel)
|
| 92 |
-
**How to Handle Excel Files in Python:**
|
| 93 |
-
Python provides libraries like `pandas` and `openpyxl` for reading, writing, and processing Excel files.
|
| 94 |
-
""")
|
| 95 |
-
|
| 96 |
-
st.write("### Convert Excel to CSV π")
|
| 97 |
-
st.code("""
|
| 98 |
-
import pandas as pd
|
| 99 |
-
# Convert a single Excel sheet to CSV
|
| 100 |
-
def excel_to_csv(excel_file, csv_file):
|
| 101 |
-
df = pd.read_excel(excel_file) # Read the Excel file
|
| 102 |
-
df.to_csv(csv_file, index=False) # Save as CSV
|
| 103 |
-
print(f"Excel file converted to {csv_file}")
|
| 104 |
-
# Example usage
|
| 105 |
-
excel_to_csv('input_file.xlsx', 'output_file.csv')
|
| 106 |
-
""", language="python")
|
| 107 |
-
|
| 108 |
-
st.write("### Convert Multiple Sheets to CSV π")
|
| 109 |
st.code("""
|
| 110 |
import pandas as pd
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
sheets = pd.read_excel(excel_file, sheet_name=None)
|
| 115 |
-
for sheet_name, data in sheets.items():
|
| 116 |
-
csv_file = f"{output_dir}/{sheet_name}.csv" # Name CSV files by sheet name
|
| 117 |
-
data.to_csv(csv_file, index=False)
|
| 118 |
-
print(f"Sheet '{sheet_name}' converted to {csv_file}")
|
| 119 |
-
# Example usage
|
| 120 |
-
excel_sheets_to_csv('input_file.xlsx', 'output_directory')
|
| 121 |
-
""", language="python")
|
| 122 |
-
|
| 123 |
-
# Placeholder button for GitHub link
|
| 124 |
-
if st.button("GitHub Link π"):
|
| 125 |
-
st.write("**GitHub Repository:** [Provide your GitHub link here]")
|
| 126 |
|
| 127 |
-
|
| 128 |
-
excel_animation_url = "https://assets9.lottiefiles.com/packages/lf20_ktn4ouly.json" # Example Lottie URL for Excel
|
| 129 |
-
excel_animation = load_lottie_url(excel_animation_url)
|
| 130 |
-
if excel_animation:
|
| 131 |
-
st_lottie(excel_animation, height=300, key="excel_animation")
|
| 132 |
-
|
| 133 |
-
if st.button("Show MySQL Databases π»"):
|
| 134 |
st.subheader("MySQL Databases")
|
| 135 |
st.write("""
|
| 136 |
-
MySQL is a relational database management system
|
| 137 |
-
It is commonly used in web applications and enterprise systems.
|
| 138 |
""")
|
| 139 |
-
|
| 140 |
-
st.write("""
|
| 141 |
-
**MySQL** is an open-source relational database management system (RDBMS) that stores structured data in tables.
|
| 142 |
-
It is widely used for managing and organizing data in web applications, enterprise systems, and data-driven projects.
|
| 143 |
-
**Key Features of MySQL:**
|
| 144 |
-
- High performance, scalability, and reliability.
|
| 145 |
-
- Support for SQL (Structured Query Language) for querying and managing data.
|
| 146 |
-
- Multi-user access and role-based permissions.
|
| 147 |
-
- Integration with multiple programming languages like Python, PHP, Java, etc.
|
| 148 |
-
**Common Use Cases:**
|
| 149 |
-
- Web application backends (e.g., WordPress, e-commerce platforms).
|
| 150 |
-
- Data analytics and reporting.
|
| 151 |
-
- Content management systems (CMS).
|
| 152 |
-
|
| 153 |
-
**MySQL Extensions:**
|
| 154 |
-
- `.sql`: Standard file extension for SQL database dumps.
|
| 155 |
-
- `.db`: Extension used by certain database systems but can also represent MySQL databases.
|
| 156 |
-
""")
|
| 157 |
-
|
| 158 |
-
st.write("""
|
| 159 |
-
### Advantages of MySQL:
|
| 160 |
-
- Open-source and free to use.
|
| 161 |
-
- Cross-platform support (Windows, Linux, macOS).
|
| 162 |
-
- Regular updates and strong community support.
|
| 163 |
-
- Supports ACID compliance for data reliability.
|
| 164 |
-
### Limitations of MySQL:
|
| 165 |
-
- Not as feature-rich as some enterprise-level database systems (e.g., Oracle, MS SQL Server).
|
| 166 |
-
- Limited support for advanced analytics and distributed databases.
|
| 167 |
-
""")
|
| 168 |
-
|
| 169 |
-
# Placeholder button for GitHub link
|
| 170 |
-
if st.button("GitHub Link π"):
|
| 171 |
-
st.write("**GitHub Repository:** [Provide your GitHub link here]")
|
| 172 |
-
|
| 173 |
-
# Optional: Add an animation for MySQL
|
| 174 |
-
mysql_animation_url = "https://assets10.lottiefiles.com/packages/lf20_kq5msyia.json" # Example Lottie URL for MySQL
|
| 175 |
-
mysql_animation = load_lottie_url(mysql_animation_url)
|
| 176 |
-
if mysql_animation:
|
| 177 |
-
st_lottie(mysql_animation, height=300, key="mysql_animation")
|
| 178 |
-
|
| 179 |
-
|
| 180 |
|
|
|
|
| 181 |
elif data_type == "Unstructured Data":
|
| 182 |
st.subheader("ποΈ Unstructured Data")
|
| 183 |
-
|
| 184 |
-
**Definition**: Unstructured data lacks any predefined structure or schema, making it the most difficult to organize and analyze.
|
| 185 |
-
It is typically raw and needs advanced processing to extract insights.
|
| 186 |
-
""")
|
| 187 |
-
|
| 188 |
-
st.write("**Features**:")
|
| 189 |
-
st.markdown("""
|
| 190 |
-
- Free-form; not stored in a tabular format.
|
| 191 |
-
- Requires specialized tools like AI or machine learning to analyze.
|
| 192 |
-
""")
|
| 193 |
-
|
| 194 |
-
st.write("**Examples of Unstructured Data**:")
|
| 195 |
-
st.markdown("""
|
| 196 |
-
1. **Images πΌοΈ**
|
| 197 |
-
2. **Videos π₯**
|
| 198 |
-
3. **Audio π**
|
| 199 |
-
4. **Text πΉ**
|
| 200 |
""")
|
|
|
|
| 201 |
|
| 202 |
-
|
| 203 |
-
if st.button("Show Image π·"):
|
| 204 |
st.subheader("Working with Images")
|
| 205 |
st.write("""
|
| 206 |
-
|
| 207 |
-
**Common File Formats:**
|
| 208 |
-
- `.jpg` or `.jpeg` (Joint Photographic Experts Group)
|
| 209 |
-
- `.png` (Portable Network Graphics)
|
| 210 |
-
- `.bmp` (Bitmap Image File)
|
| 211 |
-
- `.tiff` (Tagged Image File Format)
|
| 212 |
-
""")
|
| 213 |
-
|
| 214 |
-
st.write("### Steps to Convert an Image into an Array π")
|
| 215 |
-
st.write("""
|
| 216 |
-
Converting an image into a numerical array is a key step in image processing. Here's how it's typically done:
|
| 217 |
-
1. Load the image using an image processing library (e.g., OpenCV or PIL).
|
| 218 |
-
2. Convert the image into a NumPy array.
|
| 219 |
-
3. Access pixel data for analysis or manipulation.
|
| 220 |
-
""")
|
| 221 |
-
|
| 222 |
-
st.write("#### Example Code: Converting an Image into an Array")
|
| 223 |
-
st.code("""
|
| 224 |
-
import cv2
|
| 225 |
-
import numpy as np
|
| 226 |
-
# Load the image
|
| 227 |
-
image_path = 'image.jpg' # Path to the image
|
| 228 |
-
image = cv2.imread(image_path) # Load image as BGR format
|
| 229 |
-
# Convert to NumPy array
|
| 230 |
-
image_array = np.array(image)
|
| 231 |
-
# Display shape and pixel data
|
| 232 |
-
print("Image Shape:", image_array.shape) # (Height, Width, Channels)
|
| 233 |
-
print("Pixel Data (Top-left):", image_array[0, 0]) # Pixel value at (0, 0)
|
| 234 |
-
""", language="python")
|
| 235 |
-
|
| 236 |
-
# Placeholder button for GitHub link
|
| 237 |
-
if st.button("Jupyter Notebook π (Image)"):
|
| 238 |
-
st.markdown("https://colab.research.google.com/drive/1BxJuxD1mzeuDnPIjwc-06J_GIU2JgO1_?usp=sharing")
|
| 239 |
-
|
| 240 |
-
if st.button("Show Video π₯"):
|
| 241 |
-
st.subheader("Working with Videos")
|
| 242 |
-
st.write("""
|
| 243 |
-
**Videos** are sequences of images (frames) that are displayed at a specific frame rate to create a moving picture. Videos are used in surveillance, entertainment, and machine learning applications like activity recognition and object detection.
|
| 244 |
-
**Common File Formats:**
|
| 245 |
-
- `.mp4` (MPEG-4 Part 14)
|
| 246 |
-
- `.avi` (Audio Video Interleave)
|
| 247 |
-
- `.mov` (QuickTime File Format)
|
| 248 |
-
- `.mkv` (Matroska Video File Format)
|
| 249 |
-
""")
|
| 250 |
-
|
| 251 |
-
st.write("### Steps to Convert a Video into Frames πΈ")
|
| 252 |
-
st.write("""
|
| 253 |
-
Breaking a video into individual frames is an important step in video analysis. Here's how it's done:
|
| 254 |
-
1. Load the video using a video processing library like OpenCV.
|
| 255 |
-
2. Loop through each frame and save or process it.
|
| 256 |
-
3. Save the frames as images for further processing.
|
| 257 |
-
""")
|
| 258 |
-
|
| 259 |
-
st.write("#### Example Code: Converting a Video into Frames")
|
| 260 |
-
st.code("""
|
| 261 |
-
import cv2
|
| 262 |
-
import os
|
| 263 |
-
# Load the video
|
| 264 |
-
video_path = 'video.mp4' # Path to the video
|
| 265 |
-
video = cv2.VideoCapture(video_path)
|
| 266 |
-
# Create a folder to store the frames
|
| 267 |
-
output_folder = 'frames'
|
| 268 |
-
os.makedirs(output_folder, exist_ok=True)
|
| 269 |
-
frame_number = 0
|
| 270 |
-
while True:
|
| 271 |
-
ret, frame = video.read() # Read the next frame
|
| 272 |
-
if not ret:
|
| 273 |
-
break # Exit if no frames are left
|
| 274 |
-
# Save the frame as an image
|
| 275 |
-
frame_path = os.path.join(output_folder, f'frame_{frame_number:04d}.jpg')
|
| 276 |
-
cv2.imwrite(frame_path, frame)
|
| 277 |
-
frame_number += 1
|
| 278 |
-
print(f"Extracted {frame_number} frames and saved to {output_folder}")
|
| 279 |
-
video.release()
|
| 280 |
-
""", language="python")
|
| 281 |
-
|
| 282 |
-
# Placeholder button for GitHub link
|
| 283 |
-
if st.button("GitHub Link π (Video)"):
|
| 284 |
-
st.write("**GitHub Repository:** [Provide your GitHub link here]")
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
if st.button("Show Audio π"):
|
| 288 |
-
st.subheader("Audio")
|
| 289 |
-
st.write("""
|
| 290 |
-
Social media posts, such as tweets, Facebook updates, or Instagram images, represent unstructured data. They contain a mix of text, images, and metadata and require NLP (Natural Language Processing) for analysis.
|
| 291 |
""")
|
| 292 |
|
| 293 |
-
if st.button("
|
| 294 |
-
st.subheader("
|
| 295 |
st.write("""
|
| 296 |
-
|
| 297 |
""")
|
| 298 |
|
| 299 |
-
#
|
| 300 |
-
st.write("This app provides a clear understanding of data and its various types, especially based on structure. π")
|
| 301 |
-
|
| 302 |
-
|
| 303 |
elif data_type == "Semi-Structured Data":
|
| 304 |
st.subheader("π Semi-Structured Data")
|
| 305 |
-
|
| 306 |
st.write("""
|
| 307 |
-
**Definition**: Semi-structured data
|
| 308 |
-
While it is more flexible than structured data, it still has some organizational components.
|
| 309 |
-
""")
|
| 310 |
-
|
| 311 |
-
st.write("**Features**:")
|
| 312 |
-
st.markdown("""
|
| 313 |
-
- Flexible schema; not bound to a rigid structure.
|
| 314 |
-
- Easier to manage than unstructured data but more complex than structured data.
|
| 315 |
""")
|
|
|
|
| 316 |
|
| 317 |
-
st.
|
| 318 |
-
st.markdown("""
|
| 319 |
-
1. **JSON Files** π
|
| 320 |
-
2. **XML Files** π
|
| 321 |
-
""")
|
| 322 |
-
|
| 323 |
-
# Buttons for Semi-Structured Data Examples
|
| 324 |
-
if st.button("Show JSON Files π"):
|
| 325 |
st.subheader("JSON Files")
|
| 326 |
st.write("""
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
- Stores data as key-value pairs.
|
| 330 |
-
- Supports nested structures, such as arrays and objects.
|
| 331 |
-
- Language-independent but derived from JavaScript.
|
| 332 |
-
**Common Use Cases:**
|
| 333 |
-
- API responses and requests in web development.
|
| 334 |
-
- Configuration files for applications.
|
| 335 |
-
- Data serialization and exchange in distributed systems.
|
| 336 |
-
**File Extension:**
|
| 337 |
-
- `.json`
|
| 338 |
-
**Advantages of JSON:**
|
| 339 |
-
- Lightweight and compact.
|
| 340 |
-
- Human-readable and easy to understand.
|
| 341 |
-
- Supported by most modern programming languages.
|
| 342 |
-
**Limitations of JSON:**
|
| 343 |
-
- Does not support comments.
|
| 344 |
-
- Less efficient for very large datasets compared to binary formats.
|
| 345 |
-
""")
|
| 346 |
-
|
| 347 |
-
st.write("### Python Example: Working with JSON π")
|
| 348 |
-
st.write("#### Reading a JSON File and Accessing Its Data")
|
| 349 |
-
st.code("""
|
| 350 |
-
import json
|
| 351 |
-
# Reading a JSON file
|
| 352 |
-
with open('data.json', 'r') as file:
|
| 353 |
-
data = json.load(file)
|
| 354 |
-
# Accessing data
|
| 355 |
-
print("Name:", data['name'])
|
| 356 |
-
print("Age:", data['age'])
|
| 357 |
-
""", language="python")
|
| 358 |
-
|
| 359 |
-
st.write("#### Writing Data to a JSON File")
|
| 360 |
-
st.code("""
|
| 361 |
-
# Writing data to a JSON file
|
| 362 |
-
new_data = {
|
| 363 |
-
"name": "John Doe",
|
| 364 |
-
"age": 30,
|
| 365 |
-
"city": "New York"
|
| 366 |
-
}
|
| 367 |
-
with open('output.json', 'w') as file:
|
| 368 |
-
json.dump(new_data, file, indent=4)
|
| 369 |
-
print("Data saved to output.json")
|
| 370 |
-
""", language="python")
|
| 371 |
-
|
| 372 |
-
# Placeholder button for GitHub link
|
| 373 |
-
if st.button("GitHub Link π (JSON)"):
|
| 374 |
-
st.write("**GitHub Repository:** [Provide your GitHub link here]")
|
| 375 |
-
|
| 376 |
-
# Optional: Add animation for JSON
|
| 377 |
-
json_animation_url = "https://assets9.lottiefiles.com/packages/lf20_9jdtwwzw.json" # Example Lottie URL for JSON
|
| 378 |
-
json_animation = load_lottie_url(json_animation_url)
|
| 379 |
-
if json_animation:
|
| 380 |
-
st_lottie(json_animation, height=300, key="json_animation")
|
| 381 |
|
| 382 |
-
|
| 383 |
-
if st.button("Show XML Files π"):
|
| 384 |
st.subheader("XML Files")
|
| 385 |
st.write("""
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
- Data is stored in a tree-like structure with nested elements.
|
| 389 |
-
- Customizable tags allow flexibility in representing data.
|
| 390 |
-
- Both human-readable and machine-readable.
|
| 391 |
-
**Common Use Cases:**
|
| 392 |
-
- Data interchange between systems.
|
| 393 |
-
- Configuration files for applications and servers.
|
| 394 |
-
- RSS feeds and web services (e.g., SOAP).
|
| 395 |
-
**File Extension:**
|
| 396 |
-
- `.xml`
|
| 397 |
-
**Advantages of XML:**
|
| 398 |
-
- Highly flexible and customizable.
|
| 399 |
-
- Self-descriptive and easy to understand.
|
| 400 |
-
- Widely supported in web and enterprise applications.
|
| 401 |
-
**Limitations of XML:**
|
| 402 |
-
- More verbose compared to JSON.
|
| 403 |
-
- Slower to parse and larger in size.
|
| 404 |
-
""")
|
| 405 |
-
|
| 406 |
-
st.write("### Python Example: Working with XML π")
|
| 407 |
-
st.write("#### Reading an XML File and Parsing Its Data")
|
| 408 |
-
st.code("""
|
| 409 |
-
import xml.etree.ElementTree as ET
|
| 410 |
-
# Parsing an XML file
|
| 411 |
-
tree = ET.parse('data.xml')
|
| 412 |
-
root = tree.getroot()
|
| 413 |
-
# Accessing data
|
| 414 |
-
for child in root:
|
| 415 |
-
print(child.tag, ":", child.text)
|
| 416 |
-
""", language="python")
|
| 417 |
-
|
| 418 |
-
st.write("#### Writing Data to an XML File")
|
| 419 |
-
st.code("""
|
| 420 |
-
import xml.etree.ElementTree as ET
|
| 421 |
-
# Creating an XML structure
|
| 422 |
-
root = ET.Element("person")
|
| 423 |
-
name = ET.SubElement(root, "name")
|
| 424 |
-
name.text = "John Doe"
|
| 425 |
-
age = ET.SubElement(root, "age")
|
| 426 |
-
age.text = "30"
|
| 427 |
-
# Writing to a file
|
| 428 |
-
tree = ET.ElementTree(root)
|
| 429 |
-
tree.write("output.xml")
|
| 430 |
-
print("Data saved to output.xml")
|
| 431 |
-
""", language="python")
|
| 432 |
-
|
| 433 |
-
# Placeholder button for GitHub link
|
| 434 |
-
if st.button("GitHub Link π (XML)"):
|
| 435 |
-
st.write("**GitHub Repository:** [Provide your GitHub link here]")
|
| 436 |
-
|
| 437 |
-
# Optional: Add animation for XML
|
| 438 |
-
xml_animation_url = "https://assets7.lottiefiles.com/packages/lf20_7ozhpxio.json" # Example Lottie URL for XML
|
| 439 |
-
xml_animation = load_lottie_url(xml_animation_url)
|
| 440 |
-
if xml_animation:
|
| 441 |
-
st_lottie(xml_animation, height=300, key="xml_animation")
|
| 442 |
|
| 443 |
-
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from streamlit_lottie import st_lottie # For Lottie animations
|
| 3 |
+
import requests
|
| 4 |
|
| 5 |
+
# Function to load Lottie animations
|
| 6 |
+
def load_lottie_url(url):
|
| 7 |
+
response = requests.get(url)
|
| 8 |
+
if response.status_code == 200:
|
| 9 |
+
return response.json()
|
| 10 |
+
return None
|
| 11 |
+
|
| 12 |
+
# Custom CSS for enhanced styling
|
| 13 |
st.markdown(
|
| 14 |
"""
|
| 15 |
<style>
|
|
|
|
| 24 |
.css-1d391kg p, .css-1v0mbdj p {
|
| 25 |
color: #B0BEC5;
|
| 26 |
}
|
|
|
|
|
|
|
|
|
|
| 27 |
.stButton > button:hover {
|
| 28 |
background-color: #4CAF50;
|
| 29 |
color: white;
|
| 30 |
transform: scale(1.05);
|
| 31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
</style>
|
| 33 |
""",
|
| 34 |
unsafe_allow_html=True,
|
| 35 |
)
|
| 36 |
|
| 37 |
+
# App Title
|
| 38 |
+
st.title("π Data Types Explorer")
|
| 39 |
|
| 40 |
+
# Sidebar for navigation
|
| 41 |
st.sidebar.subheader("π Explore Data Types")
|
|
|
|
|
|
|
| 42 |
data_type = st.sidebar.selectbox(
|
| 43 |
"Select a Type of Data:",
|
| 44 |
["Structured Data", "Unstructured Data", "Semi-Structured Data"]
|
| 45 |
)
|
| 46 |
|
| 47 |
+
# Structured Data Section
|
| 48 |
if data_type == "Structured Data":
|
| 49 |
st.subheader("π Structured Data")
|
| 50 |
st.write("""
|
| 51 |
+
**Definition**: Structured data is organized and stored in a predefined format like rows and columns, making it easily searchable and manageable.
|
|
|
|
| 52 |
""")
|
|
|
|
|
|
|
| 53 |
st.markdown("""
|
| 54 |
+
**Features**:
|
| 55 |
+
- Fixed schema (e.g., tables with defined columns and data types).
|
| 56 |
+
- Easy to process using query languages like SQL.
|
| 57 |
+
- Relationships between data points are well-defined.
|
| 58 |
""")
|
| 59 |
+
st.markdown("**Examples**: Excel Files π, MySQL Databases πΎ")
|
| 60 |
|
| 61 |
+
if st.button("Learn About Excel Files π"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
st.subheader("Excel Files")
|
| 63 |
st.write("""
|
| 64 |
+
Excel files store structured data in rows and columns, making them ideal for analysis, visualization, and calculations.
|
|
|
|
| 65 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
st.code("""
|
| 67 |
import pandas as pd
|
| 68 |
+
df = pd.read_excel('file.xlsx')
|
| 69 |
+
df.to_csv('file.csv', index=False)
|
| 70 |
+
""", language="python")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
+
if st.button("Learn About MySQL Databases π»"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
st.subheader("MySQL Databases")
|
| 74 |
st.write("""
|
| 75 |
+
MySQL is a relational database management system for storing structured data in tables. SQL is used to query and manipulate data.
|
|
|
|
| 76 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
+
# Unstructured Data Section
|
| 79 |
elif data_type == "Unstructured Data":
|
| 80 |
st.subheader("ποΈ Unstructured Data")
|
| 81 |
+
st.write("""
|
| 82 |
+
**Definition**: Unstructured data lacks any predefined structure or schema, making it the most difficult to organize and analyze.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
""")
|
| 84 |
+
st.markdown("**Examples**: Images πΌοΈ, Videos π₯, Audio π, Text π")
|
| 85 |
|
| 86 |
+
if st.button("Learn About Images π·"):
|
|
|
|
| 87 |
st.subheader("Working with Images")
|
| 88 |
st.write("""
|
| 89 |
+
Images are a form of unstructured data represented as grids of pixels. Common formats include JPG, PNG, and BMP.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
""")
|
| 91 |
|
| 92 |
+
if st.button("Learn About Videos π₯"):
|
| 93 |
+
st.subheader("Working with Videos")
|
| 94 |
st.write("""
|
| 95 |
+
Videos are sequences of frames used in various applications like object detection and activity recognition. Common formats include MP4 and AVI.
|
| 96 |
""")
|
| 97 |
|
| 98 |
+
# Semi-Structured Data Section
|
|
|
|
|
|
|
|
|
|
| 99 |
elif data_type == "Semi-Structured Data":
|
| 100 |
st.subheader("π Semi-Structured Data")
|
|
|
|
| 101 |
st.write("""
|
| 102 |
+
**Definition**: Semi-structured data is partially organized using tags or key-value pairs. It is more flexible than structured data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
""")
|
| 104 |
+
st.markdown("**Examples**: JSON Files π, XML Files π")
|
| 105 |
|
| 106 |
+
if st.button("Learn About JSON Files π"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
st.subheader("JSON Files")
|
| 108 |
st.write("""
|
| 109 |
+
JSON stores data as key-value pairs and is commonly used in APIs and web development.
|
| 110 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
if st.button("Learn About XML Files π"):
|
|
|
|
| 113 |
st.subheader("XML Files")
|
| 114 |
st.write("""
|
| 115 |
+
XML stores data in a tree structure with nested elements. It is used in configuration files and data exchange.
|
| 116 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
# Footer
|
| 119 |
+
st.write("This app provides a clear understanding of different data types. π")
|