Mpavan45 commited on
Commit
8721ccd
·
verified ·
1 Parent(s): 00ebd9f

Update pages/Introduction.py

Browse files
Files changed (1) hide show
  1. 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
- # Introduction and About Data
5
- st.title("Introduction and About Data")
6
  st.markdown("""
7
- Welcome to the Hotel Data Analysis App. This app helps analyze hotel datasets, perform feature engineering,
8
- and create predictive models. Use the sidebar to navigate through the pages.
9
 
10
- **Features**:
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
- **About the Data**:
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
- st.markdown("### Download the Dataset")
22
- sample_data = pd.read_csv(r"C:\Users\user\Downloads\agoda_data.csv")
23
- df = pd.DataFrame(sample_data)
24
- csv = df.to_csv(index=False).encode('utf-8')
25
- st.download_button("Download Sample Dataset", data=csv, file_name="hotel_data.csv", mime="text/csv")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.")