/ ---
/ jupyter:
/   jupytext:
/     text_representation:
/       extension: .q
/       format_name: light
/       format_version: '1.5'
/       jupytext_version: 1.14.4
/ ---

/ + cell_id="00000-d1d3b693-8fc2-4852-b977-bf59db96cdf7" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=1 execution_start=1634670769787 source_hash="120b09e9" tags=[]
import pathlib
import pandas as pd

BASE_DIR = pathlib.Path().resolve().parent
COURSE_DIR = BASE_DIR / "course"
SAMPLES_DIR = COURSE_DIR / 'samples'


/ + cell_id="00001-4da4045c-083d-4950-a801-f30394e6b103" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=64 execution_start=1634670843243 source_hash="811c99cf" tags=[]
init_df = pd.read_csv(SAMPLES_DIR / '2.csv')
init_df.head()

/ + cell_id="00002-c7f63dad-4bd5-49fb-befc-dd9d01183da4" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=34 execution_start=1634670926698 source_hash="2c5513cb" tags=[]
columns = ['name', 'salary_as_float']
df = init_df.copy()[columns]
df.head()

/ + cell_id="00003-7151714e-0b8b-46ac-a35e-f057309c0bd2" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=2 execution_start=1634670959996 source_hash="889a1265" tags=[]
n_rows = df.shape[0] # (rows, cols)

/ + cell_id="00004-4a2dced2-1c95-42cc-9c4d-be27b5ab38f4" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=5 execution_start=1634671018731 source_hash="cd46aaa8" tags=[]
salaries = list(df['salary_as_float'].values)
sum_salaries = sum(salaries)
avg_salaries = sum_salaries / n_rows
print(avg_salaries)

/ + cell_id="00005-ac5763c8-8738-4ebb-823b-252a21900f4d" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=8 execution_start=1634671056500 source_hash="1e1d38cd" tags=[]
avg = df['salary_as_float'].mean()
avg

/ + cell_id="00006-4f6b6acb-26b3-499f-a66a-12c9123cc087" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=7 execution_start=1634671094965 source_hash="3e7b4aaa" tags=[]
df_sum = df['salary_as_float'].sum() # / n_rows
df_sum

/ + cell_id="00007-a33f5ea6-757b-44f9-abf0-25c4d3d8e645" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=9 execution_start=1634671153935 source_hash="8a870ad4" tags=[]
df_mode = df['salary_as_float'].mode()
df_mode

/ + cell_id="00008-b944d33a-73af-458a-9183-e1ec7eca7685" deepnote_cell_type="code" deepnote_to_be_reexecuted=false execution_millis=3 execution_start=1634671186003 source_hash="e2c1864b" tags=[]
top_salary = df['salary_as_float'].max()
bottom_salary = df['salary_as_float'].min()
print(top_salary, bottom_salary)

/ + [markdown] created_in_deepnote_cell=true deepnote_cell_type="markdown" tags=[]
/ <a style='text-decoration:none;line-height:16px;display:flex;color:#5B5B62;padding:10px;justify-content:end;' href='https://deepnote.com?utm_source=created-in-deepnote-cell&projectId=07445f6e-2e90-46a0-bcba-e6988a45d7c3' target="_blank">
/ <img alt='Created in deepnote.com' style='display:inline;max-height:16px;margin:0px;margin-right:7.5px;' src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIH<KEY> > </img>
/ Created in <span style='font-weight:600;margin-left:4px;'>Deepnote</span></a>

StarcoderdataJupyterScriptsDedupFiltered