Machine_Learning / pages /Types of Data.py
Phani1008's picture
Update pages/Types of Data.py
7a76f54 verified
import streamlit as st
from streamlit_lottie import st_lottie # For Lottie animations
import requests
# Function to load Lottie animations
def load_lottie_url(url):
response = requests.get(url)
if response.status_code == 200:
return response.json()
return None
# Custom CSS for enhanced styling
st.markdown(
"""
<style>
.stApp {
background: linear-gradient(135deg, #1f1c2c, #928dab);
color: #E0E0E0;
}
.stTitle {
text-align: center;
color: #76FF03;
}
.css-1d391kg p, .css-1v0mbdj p {
color: #B0BEC5;
}
.stButton > button:hover {
background-color: #4CAF50;
color: white;
transform: scale(1.05);
}
</style>
""",
unsafe_allow_html=True,
)
# App Title
st.title("πŸ“Š Data Types Explorer")
# Sidebar for navigation
st.sidebar.subheader("πŸ” Explore Data Types")
data_type = st.sidebar.selectbox(
"Select a Type of Data:",
["Structured Data", "Unstructured Data", "Semi-Structured Data"]
)
# Structured Data Section
if data_type == "Structured Data":
st.subheader("πŸ“‹ Structured Data")
st.write("""
**Definition**: Structured data is organized and stored in a predefined format like rows and columns, making it easily searchable and manageable.
""")
st.markdown("""
**Features**:
- Fixed schema (e.g., tables with defined columns and data types).
- Easy to process using query languages like SQL.
- Relationships between data points are well-defined.
""")
st.markdown("**Examples**: Excel Files πŸ“Š, MySQL Databases πŸ’Ύ")
if st.button("Learn About Excel Files πŸ“‚"):
st.subheader("Excel Files")
st.write("""
Excel files store structured data in rows and columns, making them ideal for analysis, visualization, and calculations.
""")
st.code("""
import pandas as pd
df = pd.read_excel('file.xlsx')
df.to_csv('file.csv', index=False)
""", language="python")
if st.button("Learn About MySQL Databases πŸ’»"):
st.subheader("MySQL Databases")
st.write("""
MySQL is a relational database management system for storing structured data in tables. SQL is used to query and manipulate data.
""")
# Unstructured Data Section
elif data_type == "Unstructured Data":
st.subheader("πŸ—‚οΈ Unstructured Data")
st.write("""
**Definition**: Unstructured data lacks any predefined structure or schema, making it the most difficult to organize and analyze.
""")
st.markdown("**Examples**: Images πŸ–ΌοΈ, Videos πŸŽ₯, Audio πŸ”Š, Text πŸ“")
if st.button("Learn About Images πŸ“·"):
st.subheader("Working with Images")
st.write("""
Images are a form of unstructured data represented as grids of pixels. Common formats include JPG, PNG, and BMP.
""")
if st.button("Learn About Videos πŸŽ₯"):
st.subheader("Working with Videos")
st.write("""
Videos are sequences of frames used in various applications like object detection and activity recognition. Common formats include MP4 and AVI.
""")
# Semi-Structured Data Section
elif data_type == "Semi-Structured Data":
st.subheader("πŸ“„ Semi-Structured Data")
st.write("""
**Definition**: Semi-structured data is partially organized using tags or key-value pairs. It is more flexible than structured data.
""")
st.markdown("**Examples**: JSON Files πŸ“‘, XML Files 🌐")
if st.button("Learn About JSON Files πŸ“„"):
st.subheader("JSON Files")
st.write("""
JSON stores data as key-value pairs and is commonly used in APIs and web development.
""")
if st.button("Learn About XML Files πŸ“„"):
st.subheader("XML Files")
st.write("""
XML stores data in a tree structure with nested elements. It is used in configuration files and data exchange.
""")
# Footer
st.write("This app provides a clear understanding of different data types. πŸŽ‰")