Skip to content

Commit

Permalink
Merge pull request #78 from LaunchCodeEducation/virtual-environments
Browse files Browse the repository at this point in the history
adding information on virtual environments
  • Loading branch information
jwoolbright23 authored Aug 14, 2024
2 parents df4e15c + a13e32b commit 81c15ae
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 23 deletions.
6 changes: 3 additions & 3 deletions content/cleaning-pandas/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
+++
pre = "<b>15. </b>"
pre = "<b>20. </b>"
chapter = true
title = "Cleaning Data with Pandas"
date = 2024-02-27T13:59:58-06:00
draft = false
weight = 15
hidden = true
weight = 20
hidden = false
+++

## Learning Objectives
Expand Down
6 changes: 3 additions & 3 deletions content/data-manipulation/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
+++
pre = "<b>16. </b>"
pre = "<b>21. </b>"
chapter = true
title = "Data Manipulation"
date = 2024-03-12T15:04:03-05:00
draft = false
weight = 16
hidden = true
weight = 21
hidden = false
+++

## Learning Objectives
Expand Down
2 changes: 1 addition & 1 deletion content/data-manipulation/exercises/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "Exercises"
title = "Exercises: Data Manipulation"
date = 2021-10-01T09:28:27-05:00
draft = false
weight = 2
Expand Down
2 changes: 1 addition & 1 deletion content/data-manipulation/studio/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "Studio"
title = "Studio: Data Manipulation"
date = 2021-10-01T09:28:27-05:00
draft = false
weight = 3
Expand Down
6 changes: 3 additions & 3 deletions content/data-visualization/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
+++
pre = "<b>17. </b>"
pre = "<b>22. </b>"
chapter = true
title = "Data Visualization with Python"
date = 2024-03-11T13:58:38-05:00
draft = false
weight = 17
hidden = true
weight = 22
hidden = false
+++

## Learning Objectives
Expand Down
2 changes: 1 addition & 1 deletion content/data-visualization/studio/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "Studio"
title = "Studio: Data Visualization with Python"
date = 2021-10-01T09:28:27-05:00
draft = false
weight = 3
Expand Down
6 changes: 3 additions & 3 deletions content/eda-with-pandas/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
+++
pre = "<b>14. </b>"
pre = "<b>19. </b>"
chapter = true
title = "Exploratory Data Analysis with pandas"
date = 2024-02-29T09:18:56-06:00
draft = false
weight = 14
hidden = true
weight = 19
hidden = false
+++

## Learning Objectives
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,32 @@ The pandas library is incredibly powerful and was built specifically for data an

We will use pandas to create, manipulate, and view data structures based on certain conditions. We will also cover some of the most common functions used when exploring data with pandas that we can use to our advantage during the exploration process.

{{% notice orange Warning "rocket" %}}
Remember to install pandas within your virtual environment! Run the following command to activate it from within your `data-analysis-projects` directory. Refer back to the section on virtual environments if you would like to revisit the material: [Virtual Environments]({{% relref "../../../installations/jupyter-notebook/_index.md#creating-a-virtual-environment" %}})

```python
source venv/bin/activate
```
{{% /notice %}}

{{% notice blue Note "rocket" %}}
To install pandas, you will need to run the following command:
To install pandas, you will need to run the following command within your virtual environment:

```python
pip install pandas
```

If the above command does not work, you may need to specify `pip3` in the command.
When you install pandas it will also install the latest version of Numpy as well. You can check your pandas and numpy versions with the following command:

```python
pip show pandas
```

```python
pip show numpy
```

If the above commands do not work, you may need to specify `pip3` in the command.

Once pandas is installed, it can be imported into your workspace in the following way:

Expand Down
39 changes: 38 additions & 1 deletion content/installations/jupyter-notebook/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,44 @@ weight = 5

[Jupyter](https://jupyter.org/) is a non-profit, open-source project that offers various tools and solutions. This course will utilize [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/) for documentation and code editing all within your browser.

The following command will install Jupyter Notebook onto your machine:
{{% notice blue Note "rocket" %}}
This course will utilize virtual environments when installing Jupyter Notebook and other external libraries onto your machine. You can read more about virtual environments here: [venv - Creation of virtual environments](https://docs.python.org/3/library/venv.html)
{{% /notice %}}

## Creating a Virtual Environment

You can create a new virtual environment inside of any directory of your choice. However, for this class it would be wise to create it inside of the root directory of your `data-analysis-projects` directory.

1. Navigate to your `data-analysis-projects` directory and run the following command:

```python
# -m (module)
# venv (venv module)
# venv (directory name - think of this last piece as a variable, you can name it anything, venv is a typical naming convention)
python -m venv venv
```

{{% notice blue Note "rocket" %}}
If the above command does not work, you may need to specify `python3`:

```python
python3 -m venv venv
```
{{% /notice %}}

The above command will create a virtual environment called `venv` using the `venv` module.

### Activating the Environment

1. While inside of the directory that you installed your virtual environment you can run the following command to activate it:

```python
source venv/bin/activate
```

Source is a built-in shell command that will execute any file provided as an argument. In this particular scenario we are sourcing the `activate` script located within `bin` directory that contains executable files.

Once you have activated your virtual enviroment, the following commands will install Jupyter Notebook within it:

```console
pip install notebook
Expand Down
2 changes: 1 addition & 1 deletion content/python-pandas-databases/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title = "Databases with Python and pandas"
date = 2024-04-17T10:00:24-05:00
draft = false
weight = 23
hidden = true
hidden = false
+++

## Learning Objectives
Expand Down
2 changes: 1 addition & 1 deletion content/sql-part-1/exercises/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ In Azure Data Studio, click on the *Open* button and navigate to the `SQL-Part-1

## In Your Notebook

Connect to `BooksDB`. If you need a refresher on how to do this, refer back to the [Installing Azure Data Studio]({{< relref "../../installations/install-azure-data/_index.md" >}}) section.
Connect to `BooksDB`. If you need a refresher on how to do this, refer back to the [Installing Azure Data Studio]({{% relref "../../installations/install-azure-data/_index.md" %}}) section.

## Submitting Your Work

Expand Down
2 changes: 1 addition & 1 deletion content/tableau-part-2/exercises/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "Exercises"
title = "Exercises: Tableau Part Two"
date = 2021-10-01T09:28:27-05:00
draft = false
weight = 2
Expand Down
2 changes: 1 addition & 1 deletion content/tableau-part-4/exercises/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "Exercises"
title = "Exercises: Tableau Part Four"
date = 2021-10-01T09:28:27-05:00
draft = false
weight = 2
Expand Down
2 changes: 1 addition & 1 deletion content/tableau-part-4/studio/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = "Studio"
title = "Studio: Tableau Part Four"
date = 2021-10-01T09:28:27-05:00
draft = false
weight = 3
Expand Down

0 comments on commit 81c15ae

Please sign in to comment.