File size: 1,811 Bytes
252b7cf 97c1648 252b7cf 8721ccd 252b7cf 8721ccd 252b7cf 8721ccd 252b7cf 8721ccd 252b7cf 8721ccd d7e25b3 8721ccd d7e25b3 97c1648 |
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 |
import streamlit as st
import pandas as pd
import os
# Set up the app's title and description
st.title("Hotel Data Analysis App")
st.markdown("""
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.
### Features:
- Download the dataset for exploration.
- Perform exploratory data analysis (EDA) and feature engineering.
- Create and evaluate machine learning models.
- Conclude insights from the analysis.
### About the Data:
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.
""")
# File upload section
st.markdown("## Upload Your Dataset")
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
# Handle file upload and dataset processing
if uploaded_file is not None:
try:
# Read the uploaded CSV file
sample_data = pd.read_csv(uploaded_file)
df = pd.DataFrame(sample_data)
# Display a preview of the dataset
st.markdown("### Dataset Preview")
st.dataframe(df.head())
# Convert the dataset to CSV for download
csv = df.to_csv(index=False).encode('utf-8')
# Add a download button for the processed dataset
st.markdown("### Download Processed Dataset")
st.download_button(
label="Download Sample Dataset",
data=csv,
file_name="hotel_data.csv",
mime="text/csv"
)
except Exception as e:
st.error(f"An error occurred while processing the file: {e}")
else:
st.warning("Please upload a dataset to proceed.")
|