Skip to content

Commit

Permalink
upload lec01
Browse files Browse the repository at this point in the history
  • Loading branch information
ylesia-wu committed Aug 8, 2024
1 parent 91079b8 commit 45310d8
Show file tree
Hide file tree
Showing 25 changed files with 23,567 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _modules/week-01.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ days:
type: lecture
title: Introduction, Data Science Lifecycle
# blank: resources/lectures/lec01/lec01-live.html
# filled: resources/lectures/lec01/lec01.html
filled: resources/lectures/lec01/lec01.html
reading: '[Ch. 1](https://learningds.org/ch/01/lifecycle_intro.html)'
- name: LEC 2
type: lecture
Expand Down
1 change: 1 addition & 0 deletions resources/lectures/lec01/data/baby.csv
74 changes: 74 additions & 0 deletions resources/lectures/lec01/dsc80_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""
Imports and helpful functions that we use in DSC 80 lectures. Use `make
setup-lec` to copy this (and custom-rise-styles.css) to the lecture folders.
Usage:
from dsc80_utils import *
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib_inline.backend_inline import set_matplotlib_formats
from IPython.display import display, IFrame, HTML

import plotly
import plotly.figure_factory as ff
import plotly.graph_objects as go
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.io as pio

# DSC 80 preferred styles
pio.templates["dsc80"] = go.layout.Template(
layout=dict(
margin=dict(l=30, r=30, t=30, b=30),
autosize=True,
width=600,
height=400,
xaxis=dict(showgrid=True),
yaxis=dict(showgrid=True),
title=dict(x=0.5, xanchor="center"),
)
)
pio.templates.default = "simple_white+dsc80"

set_matplotlib_formats("svg")
sns.set_context("poster")
sns.set_style("whitegrid")
plt.rcParams["figure.figsize"] = (10, 5)

# display options for numpy and pandas
np.set_printoptions(threshold=20, precision=2, suppress=True)
pd.set_option("display.max_rows", 7)
pd.set_option("display.max_columns", 8)
pd.set_option("display.precision", 2)

# Use plotly as default plotting engine
pd.options.plotting.backend = "plotly"


def display_df(
df, rows=pd.options.display.max_rows, cols=pd.options.display.max_columns
):
"""Displays n rows and cols from df"""
with pd.option_context(
"display.max_rows", rows, "display.max_columns", cols
):
display(df)


def dfs_side_by_side(*dfs):
"""
Displays two or more dataframes side by side.
"""
display(
HTML(
f"""
<div style="display: flex; gap: 1rem;">
{''.join(df.to_html() for df in dfs)}
</div>
"""
)
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/book-cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/bt.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/cape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/dewey.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions resources/lectures/lec01/imgs/ds-lifecycle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/image_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/image_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/image_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/my-winter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/oreilly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/sp24-schedule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/suraj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lectures/lec01/imgs/survey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 45310d8

Please sign in to comment.