Skip to content

Jupyter notebook crashes, does not show variables and restarting does not fix #252009

Open
@Georgewxm

Description

@Georgewxm

Type: Performance Issue

I ran the code below and got the following error message:

The window is not responding
You can reopen or close the window or keep waiting.

also after that message no matter which cell I run, what I run the results dont show up, not even when the cell triggers errors -it's barely usable

also I tried re-opening the notebook, turning on and off extensions, switching to vscode (not insider), everything! nothing would help.

plz help thank u

code:

import pandas as pd
import numpy as np

px = pd.read_csv("cta_data/px.csv", parse_dates=["date"], index_col="date")
rx = pd.read_csv("cta_data/rx.csv", parse_dates=["date"], index_col="date")
vx = (rx.ewm(span=5, min_periods=5).std() + rx.ewm(span=21, min_periods=21).std() + rx.ewm(span=63, min_periods=63).std()) / 3

cutoffs = [5, 10, 21, 63, 126, 252]
mas = {}
mas_zscores = {}
z_window_multiplier = 2

for col in px.columns:
    # Do frequency de
    ma = {}
    for c in range(len(cutoffs)):
        if c == 0:
            ma[f"real - ma{cutoffs[c]}"] = px[col] - px.ewm(span=cutoffs[c], min_periods=cutoffs[c]).mean()[col]
        else:
            ma[f"ma{cutoffs[c-1]} - ma{cutoffs[c]}"] = (
                px.ewm(span=cutoffs[c - 1], min_periods=cutoffs[c - 1]).mean()[col] - px.ewm(span=cutoffs[c], min_periods=cutoffs[c]).mean()[col]
            )
    ma[f"ma{cutoffs[c]}"] = px.ewm(span=cutoffs[c], min_periods=cutoffs[c]).mean()[col]
    ma = pd.DataFrame(ma)
    mas[col] = ma

    ma_z = pd.DataFrame(columns=ma.columns, index=ma.index)

    for c, cutoff in enumerate(cutoffs):
        z_window = cutoff * z_window_multiplier
        ma_z.iloc[:, c] = (ma.iloc[:, c] - ma.iloc[:, c].ewm(span=21, min_periods=21).mean()) / ma.iloc[:, c].ewm(
            span=21, min_periods=21
        ).std()

    mas_zscores[col] = ma_z


ma.diff().corr().style.background_gradient()

ma_z.diff().corr().style.background_gradient()

list(mas.keys())

tmp = mas['S&P 500 (CME)']

axes = tmp.plot(subplots=True, sharex=False, figsize=(12, 8))
for i, ax_i in enumerate(axes):
    if i != len(axes) - 1:
        ax_i.axhline(0, color='red', linestyle='--')
plt.tight_layout()
plt.show()

tmp_z = mas_zscores["S&P 500 (CME)"]

axes = tmp_z.plot(subplots=True, sharex=False, figsize=(12, 8))
for i, ax_i in enumerate(axes):
    if i != len(axes) - 1:
        ax_i.axhline(0, color="red", linestyle="--")
plt.tight_layout()
plt.show()

VS Code version: Code - Insiders 1.102.0-insider (Universal) (bdc1dd9, 2025-06-20T09:31:30.580Z)
OS version: Darwin arm64 24.4.0
Modes:

System Info
Item Value
CPUs Apple M2 (8 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 5, 4, 4
Memory (System) 16.00GB (0.11GB free)
Process Argv --crash-reporter-id fac56a63-02c6-4aef-b1f5-e94ff3d32aed
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    4	28147497671	 86188	code-insiders
    0	11258999068	 86191	   gpu-process
    0	5629499534	 86192	   utility-network-service
    0	8444249301	 86209	pty-host
    1	16888498603	 86225	shared-process
    0	     0	 93166	     /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	39406496739	 93120	window [2] (Welcome)
    0	8444249301	 93121	file-watcher [2]
    0	28147497671	 93122	extension-host [2]
    0	8444249301	 93123	     /Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=93122
Workspace Info
;
Extensions (23)
Extension Author (truncated) Version
bracket-select chu 2.0.2
prettier-vscode esb 11.0.0
copilot Git 1.336.0
copilot-chat Git 0.28.1
gc-excelviewer Gra 4.2.63
marp-vscode mar 3.2.0
rainbow-csv mec 3.19.0
black-formatter ms- 2025.2.0
debugpy ms- 2025.8.0
python ms- 2025.8.0
vscode-pylance ms- 2025.6.1
datawrangler ms- 1.22.0
jupyter ms- 2025.5.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.2025012901
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
remote-ssh ms- 0.120.0
remote-ssh-edit ms- 0.87.0
remote-explorer ms- 0.5.0
vscode-speech ms- 0.16.0
chatgpt ope 0.1.1741291060
pdf tom 1.2.2
A/B Experiments
vspor879:30202332
vspor708:30202333
vspor363:30204092
c4g48928:30535728
962ge761:30841072
dsvsc014:30777825
dsvsc015:30821418
pythontbext0:30879054
cppperfnew:30980852
pythonrstrctxt:31093868
e80f6927:31120813
dwcopilot:31158714
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
pythoneinst12:31251391
bgtreat:31252123
c7cif404:31309980
996jf627:31264550
usemplatestapi:31297334
generatesymbolt:31280541
convertfstringf:31280702

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions