NotebookConsole

Jupyter Notebook's Console

A Jupyter console is an interactive terminal that allows you to execute code, inspect variables, and use shell commands.

It is connected to a Jupyter notebook’s Python kernel, which means that you can access the same variables and functions that are defined in the notebook. This makes it a powerful tool for debugging and testing code, as well as for exploring data interactively.

This notebook provides an example on how to open a Jupyter console in VIM which is connected to the notebook’s kernel. To integrate Vim with a Jupyter Console, it's possible to use the vim-floaterm plugin.

In [11]:
# Cell 1: Import the libraries
import pandas as pd
import numpy as np
In [12]:
# Cell 2: Create a DataFrame with some random data
df = pd.DataFrame(np.random.randint(0, 100, size=(10, 4)), columns=list('ABCD'))
df
Out[12]:
A B C D
0 0 96 26 16
1 81 36 42 26
2 21 42 61 56
3 81 16 42 6
4 22 8 42 53
5 59 48 59 95
6 82 66 34 3
7 58 88 16 84
8 44 31 9 61
9 90 94 5 27

Descriptive statistics

In [30]:
# Cell 3: Calculate some statistics on the DataFrame
df.describe(percentiles = [.5])
Out[30]:
A B C D
count 10.000000 10.000000 10.000000 10.000000
mean 53.800000 52.500000 33.600000 42.700000
std 31.104841 32.032102 19.431932 32.007117
min 0.000000 8.000000 5.000000 3.000000
50% 58.500000 45.000000 38.000000 40.000000
max 90.000000 96.000000 61.000000 95.000000

Correlation matrix

In [28]:
df.corr()
Out[28]:
A B C D
A 1.000000 0.021969 -0.188388 -0.245709
B 0.021969 1.000000 -0.504997 -0.053591
C -0.188388 -0.504997 1.000000 0.141095
D -0.245709 -0.053591 0.141095 1.000000
In [14]:
# Cell 4: Sort the DataFrame by column A
# df.sort_values(by='A')
In [ ]: