scripts/step3.py
def education_level_salary(df):
    """Plots the correlation between salary and education level in a Scatter plot.

    Parameters
    ----------
    df : pandas.DataFrame
        A pandas DataFrame containing job offers data.

    """

    # Remove outliers.
    df = df[df["salary"] <= 35000].copy()

    # We are going to map the education levels with a number.
    # The greater th enumber is the greater the education level.
    education_map = {
        "Primaria": 1,
        "Secundaria/sec. técnica": 2,
        "Prepa o vocacional": 3,
        "Carrera técnica": 4,
        "Carrera comercial": 4,
        "Profesional técnico": 4,
        "T. superior universitario": 4,
        "Licenciatura": 5,
        "Maestría": 6,
        "Doctorado": 7
    }

    # We convert the categorical data to numerical.
    df["education_level"] = df["education_level"].apply(
        lambda x: education_map[x])

   # Initialize our Figure.
    fig = go.Figure()

    fig.add_traces(go.Scatter(x=df["education_level"], y=df["salary"], line_color="#ffa000",
                              mode="markers", line_width=3, marker_size=8))

    fig.update_xaxes(title="Education Level", ticks="outside", ticklen=10,
                     tickcolor="#FFFFFF", title_standoff=30, linewidth=2, showline=True, mirror=True, nticks=7, gridwidth=0.5)

    fig.update_yaxes(title="Monthly Salary in MXN", ticks="outside", ticklen=10, separatethousands=True,
                     tickcolor="#FFFFFF", title_standoff=20, linewidth=2, showline=True, mirror=True, nticks=12, gridwidth=0.5)

    # Add final customizations.
    fig.update_layout(
        showlegend=False,
        width=1200,
        height=800,
        font_color="#FFFFFF",
        font_size=18,
        title_text="Comparison of Education Level and Monthly Salary",
        title_x=0.5,
        title_y=0.93,
        margin_l=140,
        margin_b=120,
        title_font_size=30,
        paper_bgcolor="#37474f",
        plot_bgcolor="#263238"
    )

    fig.write_image("12.png")
Plots the correlation between salary and education level in a Scatter plot.

    Parameters
    ----------
    df : pandas.DataFrame
        A pandas DataFrame containing job offers data.

    
Plots the correlation between salary and education level in a Scatter plot.
Parameters

df : pandas.DataFrame
A pandas DataFrame containing job offers data.
Plots the correlation between salary and education level in a Scatter plot . Parameters df : pandas . DataFrame A pandas DataFrame containing job offers data .
def education_level_salary(df):
    df = df[df["salary"] <= 35000].copy()
    education_map = {
        "Primaria": 1,
        "Secundaria/sec. técnica": 2,
        "Prepa o vocacional": 3,
        "Carrera técnica": 4,
        "Carrera comercial": 4,
        "Profesional técnico": 4,
        "T. superior universitario": 4,
        "Licenciatura": 5,
        "Maestría": 6,
        "Doctorado": 7
    }
    df["education_level"] = df["education_level"].apply(
        lambda x: education_map[x])
    fig = go.Figure()
    fig.add_traces(go.Scatter(x=df["education_level"], y=df["salary"], line_color="#ffa000",
                              mode="markers", line_width=3, marker_size=8))
    fig.update_xaxes(title="Education Level", ticks="outside", ticklen=10,
                     tickcolor="#FFFFFF", title_standoff=30, linewidth=2, showline=True, mirror=True, nticks=7, gridwidth=0.5)
    fig.update_yaxes(title="Monthly Salary in MXN", ticks="outside", ticklen=10, separatethousands=True,
                     tickcolor="#FFFFFF", title_standoff=20, linewidth=2, showline=True, mirror=True, nticks=12, gridwidth=0.5)
    fig.update_layout(
        showlegend=False,
        width=1200,
        height=800,
        font_color="#FFFFFF",
        font_size=18,
        title_text="Comparison of Education Level and Monthly Salary",
        title_x=0.5,
        title_y=0.93,
        margin_l=140,
        margin_b=120,
        title_font_size=30,
        paper_bgcolor="#37474f",
        plot_bgcolor="#263238"
    )
    fig.write_image("12.png")
def education_level_salary ( df ) : df = df [ df [ "salary" ] <= 35000 ] . copy ( ) education_map = { "Primaria" : 1 , "Secundaria/sec. técnica": , "Prepa o vocacional" : 3 , "Carrera técnica": , "Carrera comercial" : 4 , "Profesional técnico": , "T. superior universitario" : 4 , "Licenciatura" : 5 , "Maestría": , "Doctorado" : 7 } df [ "education_level" ] = df [ "education_level" ] . apply ( lambda x : education_map [ x ] ) fig = go . Figure ( ) fig . add_traces ( go . Scatter ( x = df [ "education_level" ] , y = df [ "salary" ] , line_color = "#ffa000" , mode = "markers" , line_width = 3 , marker_size = 8 ) ) fig . update_xaxes ( title = "Education Level" , ticks = "outside" , ticklen = 10 , tickcolor = "#FFFFFF" , title_standoff = 30 , linewidth = 2 , showline = True , mirror = True , nticks = 7 , gridwidth = 0.5 ) fig . update_yaxes ( title = "Monthly Salary in MXN" , ticks = "outside" , ticklen = 10 , separatethousands = True , tickcolor = "#FFFFFF" , title_standoff = 20 , linewidth = 2 , showline = True , mirror = True , nticks = 12 , gridwidth = 0.5 ) fig . update_layout ( showlegend = False , width = 1200 , height = 800 , font_color = "#FFFFFF" , font_size = 18 , title_text = "Comparison of Education Level and Monthly Salary" , title_x = 0.5 , title_y = 0.93 , margin_l = 140 , margin_b = 120 , title_font_size = 30 , paper_bgcolor = "#37474f" , plot_bgcolor = "#263238" ) fig . write_image ( "12.png" )
Plots the correlation between salary and education level in a Scatter plot.
Plots the correlation between salary and education level in a Scatter plot .
"""Plots the correlation between salary and education level in a Scatter plot.

    Parameters
    ----------
    df : pandas.DataFrame
        A pandas DataFrame containing job offers data.

    """ # Remove outliers. # We are going to map the education levels with a number. # The greater th enumber is the greater the education level. # We convert the categorical data to numerical. # Initialize our Figure. # Add final customizations.
df