<commit_before>---
layout: default
---

# Course setup

To get started, you should have the following three elements setup:

1. Install Python and the required Python packages
2. Download the course material to your computer
3. Test your configuration and installation
4. Start Jupyter lab

In the following sections, more details are provided for each of these steps. When all three are done, you are ready to start coding!

## 1. (_before the course_) Install Python and the required Python packages

For scientific and data analysis, we recommend to use Anaconda (or Miniconda) (<https://www.anaconda.com/download/>), which provides a Python
distribution that includes the scientific libraries (this recommendation applies to all platforms, so for both Windows, Linux and Mac),
instead of installing Python as such. After installation, proceed with the setup.

### Install Anaconda

#### Option 1: I do not have Anaconda installed

For first time users and people not fully confident with using the command line, we advise to install Anaconda, by downloading and installing
the Python 3.x version from <https://www.anaconda.com/download/>. Recent computers will require the 64-Bit installer.

For more detailed instructions to install Anaconda, check the [Windows](https://docs.anaconda.com/anaconda/install/windows/),
[Mac](https://docs.anaconda.com/anaconda/install/mac-os/) or [linux](https://docs.anaconda.com/anaconda/install/linux/) installation tutorial.

**Note:** When you are already familiar with the command line and Python environments you could opt to use Miniconda instead of Anaconda
and download it from <https://conda.io/miniconda.html>. The main difference is that Anaconda provides a graphical user interface (Anaconda navigator)
and a whole lot of scientific packages (e.g <https://docs.anaconda.com/anaconda/packages/py3.9_win-64/>) when installing, whereas for Miniconda
the user needs to install all packages using the command line. On the other hand, Miniconda requires less disk space.

#### Option 2: I have installed Anaconda earlier

When you already have an installation of Anaconda, you have to make sure you are working with the most recent versions. As the course is
developed for Python 3, make sure you have Anaconda3 (on Windows, check Start > Programs > Anaconda3). If not, reinstall Anaconda according
to the previous section.

Start the Anaconda Navigator program (for Windows users: Start > Anaconda Navigator) and go to the Environments tab. You should see
the *base (root) environment*, click the arrow next to it and click `Open terminal`, as shown in the following figure:

![Navigator terminal](./static/img/navigator_terminal.png)

Type following command + ENTER-button (make sure you have an internet connection):

```
conda update -n root conda
```
and respond with *Yes* by typing `y`. Packages should be updated after the completion of the command.

### Setup after Anaconda installation

As not all packages we will use in the course are provided by default as part of Anaconda, we have to add the package to Anaconda to get started.
As a good practice, we will create a new _conda environment_ to work with. This environment will contain the required packages on which this
course depends.

The packages used in the course are enlisted in
an [`environment.yml` file](https://raw.githubusercontent.com/jorisvandenbossche/DS-python-data-analysis/main/environment.yml). The file looks as follows:

```
name: DS-python
channels:
- defaults
- conda-forge
dependencies:
- python=3.9
- ipython
- jupyter
- ...
```

The file contains information on:
- `name` is the name used for the environment
- `channels` to define where to download the packages from
- `dependencies` contains each of the packages

To download the environment file, click to go to
the [environment.yml](https://raw.githubusercontent.com/jorisvandenbossche/DS-python-data-analysis/master/environment.yml) online. Once opened in the
browser, right-click and save the file/page on your computer. The specific text depends on your browser (`Save page as...`, `Save as...`).

__WARNING !__ Make sure you save the file as `environment.yml` instead of `environment.yml.txt` which, specifically on Windows operating system,
might be the default option. To do so, choose for 'save as type' _All Files_ instead of 'Text Document'.

![](./static/img/environment_save.png)

You will need the folder/directory containing the `environment.yml` file in the next step. Make sure you know where you stored the file on
your computer, e.g. when stored in the folder `C:/Users/yourusername/Documents` you should see the file `environment.yml` in File Explorer
in that directory.

Next, start the Anaconda Navigator program (for windows users: Start > Anaconda Navigator) and go to the Environments tab. You should see
the *base (root) environment*, click the arrow next to it and click `Open terminal`, as shown in the following figure:

![Navigator terminal](./static/img/navigator_terminal.png)

Type following commands line by line + ENTER-button (make sure you have an internet connection):

```
conda config --add channels conda-forge
conda config --set channel_priority strict
cd FOLDER_PATH_TO_ENVIRONMENT_FILE
conda env create -f environment.yml
```

__!__ `FOLDER_PATH_TO_ENVIRONMENT_FILE` should be replaced by the path to the folder containing the downloaded environment file. In the
example earlier, this was `C:/Users/yourusername/Documents`, but make sure you use your specific folder (as seen in File Explorer).

Respond with *Yes* by typing `y` when asked. Output will be printed and if no error occurs, you should have the environment configured
with all packages installed.
<commit_msg>Fix wrong branhc name master<commit_after>---
layout: default
---

# Course setup

To get started, you should have the following three elements setup:

1. Install Python and the required Python packages
2. Download the course material to your computer
3. Test your configuration and installation
4. Start Jupyter lab

In the following sections, more details are provided for each of these steps. When all three are done, you are ready to start coding!

## 1. (_before the course_) Install Python and the required Python packages

For scientific and data analysis, we recommend to use Anaconda (or Miniconda) (<https://www.anaconda.com/download/>), which provides a Python
distribution that includes the scientific libraries (this recommendation applies to all platforms, so for both Windows, Linux and Mac),
instead of installing Python as such. After installation, proceed with the setup.

### Install Anaconda

#### Option 1: I do not have Anaconda installed

For first time users and people not fully confident with using the command line, we advise to install Anaconda, by downloading and installing
the Python 3.x version from <https://www.anaconda.com/download/>. Recent computers will require the 64-Bit installer.

For more detailed instructions to install Anaconda, check the [Windows](https://docs.anaconda.com/anaconda/install/windows/),
[Mac](https://docs.anaconda.com/anaconda/install/mac-os/) or [linux](https://docs.anaconda.com/anaconda/install/linux/) installation tutorial.

**Note:** When you are already familiar with the command line and Python environments you could opt to use Miniconda instead of Anaconda
and download it from <https://conda.io/miniconda.html>. The main difference is that Anaconda provides a graphical user interface (Anaconda navigator)
and a whole lot of scientific packages (e.g <https://docs.anaconda.com/anaconda/packages/py3.9_win-64/>) when installing, whereas for Miniconda
the user needs to install all packages using the command line. On the other hand, Miniconda requires less disk space.

#### Option 2: I have installed Anaconda earlier

When you already have an installation of Anaconda, you have to make sure you are working with the most recent versions. As the course is
developed for Python 3, make sure you have Anaconda3 (on Windows, check Start > Programs > Anaconda3). If not, reinstall Anaconda according
to the previous section.

Start the Anaconda Navigator program (for Windows users: Start > Anaconda Navigator) and go to the Environments tab. You should see
the *base (root) environment*, click the arrow next to it and click `Open terminal`, as shown in the following figure:

![Navigator terminal](./static/img/navigator_terminal.png)

Type following command + ENTER-button (make sure you have an internet connection):

```
conda update -n root conda
```
and respond with *Yes* by typing `y`. Packages should be updated after the completion of the command.

### Setup after Anaconda installation

As not all packages we will use in the course are provided by default as part of Anaconda, we have to add the package to Anaconda to get started.
As a good practice, we will create a new _conda environment_ to work with. This environment will contain the required packages on which this
course depends.

The packages used in the course are enlisted in
an [`environment.yml` file](https://raw.githubusercontent.com/jorisvandenbossche/DS-python-data-analysis/main/environment.yml). The file looks as follows:

```
name: DS-python
channels:
- defaults
- conda-forge
dependencies:
- python=3.9
- ipython
- jupyter
- ...
```

The file contains information on:
- `name` is the name used for the environment
- `channels` to define where to download the packages from
- `dependencies` contains each of the packages

To download the environment file, click to go to
the [environment.yml](https://raw.githubusercontent.com/jorisvandenbossche/DS-python-data-analysis/main/environment.yml) online. Once opened in the
browser, right-click and save the file/page on your computer. The specific text depends on your browser (`Save page as...`, `Save as...`).

__WARNING !__ Make sure you save the file as `environment.yml` instead of `environment.yml.txt` which, specifically on Windows operating system,
might be the default option. To do so, choose for 'save as type' _All Files_ instead of 'Text Document'.

![](./static/img/environment_save.png)

You will need the folder/directory containing the `environment.yml` file in the next step. Make sure you know where you stored the file on
your computer, e.g. when stored in the folder `C:/Users/yourusername/Documents` you should see the file `environment.yml` in File Explorer
in that directory.

Next, start the Anaconda Navigator program (for windows users: Start > Anaconda Navigator) and go to the Environments tab. You should see
the *base (root) environment*, click the arrow next to it and click `Open terminal`, as shown in the following figure:

![Navigator terminal](./static/img/navigator_terminal.png)

Type following commands line by line + ENTER-button (make sure you have an internet connection):

```
conda config --add channels conda-forge
conda config --set channel_priority strict
cd FOLDER_PATH_TO_ENVIRONMENT_FILE
conda env create -f environment.yml
```

__!__ `FOLDER_PATH_TO_ENVIRONMENT_FILE` should be replaced by the path to the folder containing the downloaded environment file. In the
example earlier, this was `C:/Users/yourusername/Documents`, but make sure you use your specific folder (as seen in File Explorer).

Respond with *Yes* by typing `y` when asked. Output will be printed and if no error occurs, you should have the environment configured
with all packages installed.

{'fraction_non_alphanumeric': 0.07339931680826838, 'fraction_numerical': 0.0033283699745992818, 'mean_word_length': 4.655274888558693, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 18, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5123143', 'n_tokens_mistral': 3051, 'n_tokens_neox': 2934, 'n_words': 1522}