viruthik's picture
Update eda.py
9e8713b
import streamlit as st
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
from PIL import Image
st.set_page_config(
page_title='Flight Price Prediction - EDA',
layout='wide',
initial_sidebar_state='expanded'
)
def runEDA():
#Title
st.title('Flight Price Prediction')
#Sub Header
st.subheader('EDA for Flight Price Prediction')
st.markdown('---')
#show dataframe
st.title('Dataset')
df = pd.read_csv('flight_price_prediction.csv')
st.dataframe(df)
plt.style.use('default')
st.write('## Histogram Price')
fig = plt.figure(figsize=(15,5))
sns.histplot(df['price'], bins=20, kde=True).set(title='Price')
st.pyplot(fig)
st.write('Based on the histogram plot, we can see that most of the flight having price less than 10k INR (Indian Rupee). But for few flight price is goes up to 120k INR, this probably the price of business class.')
st.markdown('---')
plt.style.use('dark_background')
fig = plt.figure(figsize=(20,8))
sns.lineplot(data=df, x='duration', y='price', hue='class', palette='hls')
plt.title('Ticket Price Versus Flight Duration Based on Class',fontsize=20)
plt.xlabel('Duration', fontsize=15)
plt.ylabel('Price', fontsize=15)
st.pyplot(fig)
st.write('Based on the line graph above, we can see that as the flight duration increase the ticket price is also increases in both the Economy and Business classes')
st.markdown('---')
fig = plt.figure(figsize=(20,8))
sns.lineplot(data=df, x='days_left', y='price', color='blue')
plt.title('Days Left For Departure Versus Ticket Price',fontsize=20)
plt.xlabel('Days Left for Departure',fontsize=15)
plt.ylabel('Price',fontsize=15)
st.pyplot(fig)
st.write('Based on the line graph above, we can see that as the flight duration increase the ticket price is also increases in both the Economy and Business classes')
st.markdown('---')
if __name__ == '__main__':
runEDA()