0% found this document useful (0 votes)
14 views15 pages

03-programming-in-python

Lecture 3 covers programming in Python, focusing on language fundamentals and practical examples. Key topics include expressions, assignment statements, function calls, and the use of tables as a standard data structure. The session emphasizes hands-on practice and understanding syntax and function arguments.

Uploaded by

1226황이진
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views15 pages

03-programming-in-python

Lecture 3 covers programming in Python, focusing on language fundamentals and practical examples. Key topics include expressions, assignment statements, function calls, and the use of tables as a standard data structure. The session emphasizes hands-on practice and understanding syntax and function arguments.

Uploaded by

1226황이진
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Lecture 3

Programming in Python
Agenda
●Announcements
●New material
○ A crash course in Python
○ A first look at tables
Announcements
● Course website announcements
● Save your notebook before generating the
zip file and/or PDF for submission!
My PollEv website!
● https://pollev.com/jeremysanchez
New material
Python is used for data science and
more!
● Master the language fundamentals!
● Learn through practice:
● see some examples
● try out variants of these yourself
● write new code that solves new
problems
Dem
First things first when it comes to
Python
●Expressions -> Values
●Syntax (it’s important!)
●Other behaviors, such
as…
○division!
Use an assignment statement to create a
name
● The name belongs to the value of the
expression to the right of the = symbol

hours_per_wk = 24 * 7

Name Any expression


Make use of functions with call
expressions

Function Argumen
name t

f (27)
"Call f on 27."
Functions can have multiple
arguments!
What
functio Second
First argument
n to argument
call

max ( 15 , 27 )
Dem
Arguments come in two types
●named:
○round(number = 12.34)

●unnamed:
○round(12.34)
Argument names are not
arbitrary!
● To see the names of arguments a function f
takes:
○ run f? in a notebook cell
■ documentation of the function
f.
A table is our standard data
structure
● Each row represents one individual
● Each column contains data on one
variable Label
Name Code Area (m2)

California CA 163696

Nevada NV 110567

Row
Column

Dem
Constructing a new table…
1.with just the specified columns?
○ t.select(label)
2.in which the specified columns are
omitted?
○ t.drop(label)
3.with rows sorted by the specified
column?
○ t.sort(label)
4.with just the rows that match a
Goodbye! 👋
End of lecture

You might also like