Skip to content

Data science environment

Quick help demonstrating how to create a simple working environment for datascience using conda and jupyter.

Note

You can replace jlab by whatever you like.

Create conda environment:

conda create -n jlab numpy pandas scipy matplotlib seaborn scikit-learn statsmodels jupyterlab

Create an ipython profile. Useful for startup scripts and kernel configuration.

ipython profile create jlab

Edit the newly created profile. For example:

subl %USERPROFILE%\\.ipython\profile_jlab\ipython_config.py

Add the following lines to import automatically the packages you're going to use most of the time:

c.InteractiveShellApp.exec_lines = [
    'import numpy as np',
    'import pandas as pd',
    'import matplotlib.pyplot as plt',
    'import seaborn as sns'
]

Edit the jupyter kernel to point to the profile:

subl %USERPROFILE%\\.conda\envs\jlab\share\jupyter\kernels\python3\kernel.json
{
    "argv": [
        "C:/Users/darko.petrovic/.conda/envs/jlab\\python.exe",
        "-m",
        "ipykernel_launcher",
        "--profile",
        "jlab",
        "-f",
        "{connection_file}"
    ],
    "display_name": "JLAB",
    "language": "python"
}