Hands-On Activities Introduction

Please review the following Introductory Slides

  • Resize Your Laptop Screen for Workshop Handouts (2 min)

Step 0: Python Definitions and considerations for beginners

Variable: a variable is a name that stores information.
Examples: x=2, name="Bob"

Data Type: a grouping of data values that have similar attributes and possible operations. It is possible to have a custom type, in which the attributes are assigned. These can become very intricate and are called objects.
Examples: int 1, float 0.345, string "hello world", boolean True or False, list [1,2,3]

Function: A series of operations that changes data or outputs something new. They look like, for example, len() a variable with brackets which you can feed information to.
Example: len("hello world") will return 11 because “hello world” is a string of length 11 (spaces count!).

Method: a method is similar to a function, but it is associated with an object.
Example: if data = [1,2,3] and we use a method data.append(4) then data would become [1,2,3,4]

Argument: An arguments is a variable you “pass” to a function or method. The function or method will use it to perform a transformation or calculation. It goes between the brackets.
Example: From the Function example len("hello world"), “hello world” is the argument. From the method example data.append(4), 4 is the argument.

Attribute: Attributes are variables that are associated with an object and tells you information about that object.
Example: dataframe.columns returns the names of the columns in a dataframe.

Library: libraries are a collection of functions and types created by other people, you can access and use what they have created.
Example: import pandas now I would have access to the methods and objects that are packaged together under the name pandas.

Environment: The place in which you run your code. Your variables and libraries are saved here until the environment is cleared. In a jupyter notebook, you have to clear the environment manually.

File paths: file paths are a surprisingly important aspect of programming, it’s important to understand how they work. If you don’t feel confident about file paths, check out this File Paths resource by codecademy
Example: /home/user/data-analysis/scripts/main.py

NEXT STEP: Load and View DataFrame