Update pages/Introduction.py
Browse files- pages/Introduction.py +36 -13
pages/Introduction.py
CHANGED
|
@@ -1,25 +1,48 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
st.title("
|
| 6 |
st.markdown("""
|
| 7 |
-
Welcome to the Hotel Data Analysis App
|
| 8 |
-
and create predictive models. Use the sidebar to navigate through the pages.
|
| 9 |
|
| 10 |
-
|
| 11 |
- Download the dataset for exploration.
|
| 12 |
- Perform exploratory data analysis (EDA) and feature engineering.
|
| 13 |
- Create and evaluate machine learning models.
|
| 14 |
- Conclude insights from the analysis.
|
| 15 |
|
| 16 |
-
|
| 17 |
-
The dataset includes hotel-related information such as price, ratings, discounts, cashback, and categories.
|
| 18 |
-
It is designed for understanding relationships between features and building predictive models.
|
| 19 |
""")
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
# Set up the app's title and description
|
| 5 |
+
st.title("Hotel Data Analysis App")
|
| 6 |
st.markdown("""
|
| 7 |
+
Welcome to the **Hotel Data Analysis App**. This app is designed to help you analyze hotel datasets, perform feature engineering, and create predictive models. Use the sidebar to navigate through the pages.
|
|
|
|
| 8 |
|
| 9 |
+
### Features:
|
| 10 |
- Download the dataset for exploration.
|
| 11 |
- Perform exploratory data analysis (EDA) and feature engineering.
|
| 12 |
- Create and evaluate machine learning models.
|
| 13 |
- Conclude insights from the analysis.
|
| 14 |
|
| 15 |
+
### About the Data:
|
| 16 |
+
The dataset includes hotel-related information such as price, ratings, discounts, cashback, and categories. It is designed for understanding relationships between features and building predictive models.
|
|
|
|
| 17 |
""")
|
| 18 |
|
| 19 |
+
# File upload section
|
| 20 |
+
st.markdown("## Upload Your Dataset")
|
| 21 |
+
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
|
| 22 |
+
|
| 23 |
+
# Handle file upload and dataset processing
|
| 24 |
+
if uploaded_file is not None:
|
| 25 |
+
try:
|
| 26 |
+
# Read the uploaded CSV file
|
| 27 |
+
sample_data = pd.read_csv(uploaded_file)
|
| 28 |
+
df = pd.DataFrame(sample_data)
|
| 29 |
+
|
| 30 |
+
# Display a preview of the dataset
|
| 31 |
+
st.markdown("### Dataset Preview")
|
| 32 |
+
st.dataframe(df.head())
|
| 33 |
+
|
| 34 |
+
# Convert the dataset to CSV for download
|
| 35 |
+
csv = df.to_csv(index=False).encode('utf-8')
|
| 36 |
+
|
| 37 |
+
# Add a download button for the processed dataset
|
| 38 |
+
st.markdown("### Download Processed Dataset")
|
| 39 |
+
st.download_button(
|
| 40 |
+
label="Download Sample Dataset",
|
| 41 |
+
data=csv,
|
| 42 |
+
file_name="hotel_data.csv",
|
| 43 |
+
mime="text/csv"
|
| 44 |
+
)
|
| 45 |
+
except Exception as e:
|
| 46 |
+
st.error(f"An error occurred while processing the file: {e}")
|
| 47 |
+
else:
|
| 48 |
+
st.warning("Please upload a dataset to proceed.")
|