import numpy as np 
import pandas as pd 
import plotly.express as px
import plotly.graph_objects as go

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

stud= pd.read_csv("/kaggle/input/students-performance-in-exams/StudentsPerformance.csv")
"""
# Bubble Chart
"""
fig = go.Figure(data=[go.Scatter(
    x=[1, 2, 3, 4], y=[10, 12, 15, 16],
    mode='markers',
    marker_size=[20, 40, 50, 60])
])

fig.show()
fig = go.Figure(data=[go.Scatter(
    x=[1, 2, 3, 4], y=[8, 10, 11, 12],
    mode='markers',
    marker=dict(
        color=['red', 'cyan',
               'blue', 'yellow'],
        opacity=[1, 0.8, 0.6, 0.4],
        size=[40, 60, 65, 70],
    )
)])

fig.show()
df = px.data.gapminder()

fig = px.scatter(df.query("year==2007"), x="gdpPercap", y="lifeExp",    size="pop", color="continent",
                 hover_name="country", log_x=True, size_max=60)
fig.show()
tips = px.data.tips()
tips.head()
fig = px.scatter(tips, x="total_bill", y="size",    size="tip", color="tip",
                  size_max=20)
fig.show()
fig = px.scatter(tips, x="total_bill", y="tip",    size="size", color="tip",
                  size_max=20)
fig.show()
fig = px.scatter(tips, x="tip", y="size",    size="total_bill", color="total_bill",
                  size_max=30)
fig.show()
"""
# Dot Plots
"""
stud.head()
fig = px.scatter(stud, x="math score", y="parental level of education", color="gender",
                 title="Student Performance in Exams"
                )

fig.show()
fig = px.scatter(stud, x="reading score", y="parental level of education", color="test preparation course",
                 title="Student Performance in Exams"
                )

fig.show()
fig = px.scatter(stud, x="writing score", y="parental level of education", color="lunch",
                 title="Student Performance in Exams"
                )

fig.show()
"""
# Horizontal Bar Chart 
"""
fig = go.Figure(go.Bar(
            x=[20, 14, 23],
            y=['Honda', 'Suzuki', 'Yamaha'],
            orientation='h'))

fig.show()
df = px.data.tips()
fig = px.bar(df, x="total_bill", y="day", orientation='h')
fig.show()
fig = px.bar(df, x="total_bill", y="sex", color='day', orientation='h',
             hover_data=["tip", "size"],
             height=400,
             title='Restaurant bills')
fig.show()
stud.info()
fig = px.bar(stud, x="math score", y="parental level of education", orientation='h')
fig.show()
fig = px.bar(stud, x="reading score", y="parental level of education",color='gender', orientation='h')
fig.show()
fig = px.bar(stud, x="writing score", y="parental level of education",color='lunch', orientation='h')
fig.show()
fig = px.bar(stud, x="writing score", y="parental level of education",color='test preparation course', orientation='h')
fig.show()
"""
# Gantt Chart
"""
df = pd.DataFrame([
    dict(Task="Development", Start='2012-01-20', Finish='2012-02-20'),
    dict(Task="Website Design", Start='2012-01-10', Finish='2012-01-30'),
    dict(Task="Deployment", Start='2012-02-20', Finish='2012-03-30'),
    dict(Task="Marketing", Start='2012-02-25', Finish='2012-04-15')
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task")
fig.update_yaxes(autorange="reversed") 
fig.show()
df = pd.DataFrame([
    dict(Task="Development", Start='2012-01-20', Finish='2012-02-20', Team="Team A"),
    dict(Task="Website Design", Start='2012-01-10', Finish='2012-01-30', Team="Team B"),
    dict(Task="Deployment", Start='2012-02-20', Finish='2012-03-30', Team="Team A"),
    dict(Task="Marketing", Start='2012-02-25', Finish='2012-04-15', Team="Team C")
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color="Team")
fig.update_yaxes(autorange="reversed") 
fig.show()
df = pd.DataFrame([
    dict(Task="Development", Start='2012-01-20', Finish='2012-02-20', Team="Team A",Team_Size=20),
    dict(Task="Website Design", Start='2012-01-10', Finish='2012-01-30', Team="Team B",Team_Size=15),
    dict(Task="Deployment", Start='2012-02-20', Finish='2012-03-30', Team="Team A",Team_Size=20),
    dict(Task="Marketing", Start='2012-02-25', Finish='2012-04-15', Team="Team C",Team_Size=32)
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task",color="Team_Size")
fig.update_yaxes(autorange="reversed") 
fig.show()