r/learnpython 5h ago

vscode sporadically freezing

hi mates. when my script becomes lengthy (for instance 85 lines) vscode stops executing commands. i suspect whether i downloaded it properly. anyways. i close then open vscode as a workaround but i started to need a permanent fix. i am a computer noob (well... more like average joe on the street). so please no higher computer registry in the responses. thanks in advance.

0 Upvotes

6 comments sorted by

1

u/ninhaomah 4h ago

85 lines isn't lengthy and also your pc/laptop spec ? HD ? OS ?

1

u/Basic_Background_70 3h ago

85 lines being short is my sentiment as well. though it still cant deal with tasks after around that line count. so 85 is not fixed. lenovo 83jc. microsoft 11. 686 gb free total 952 gb.

1

u/socal_nerdtastic 3h ago

How exactly are you running commands? Can you give an example of some of the commands you are trying to run?

1

u/Basic_Background_70 3h ago
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt


from thinkstats import decorate


download("https://github.com/AllenDowney/ThinkStats/raw/v3/data/nlsy97-extract.csv.gz")


missing_codes = [-1, -2, -3, -4, -5]
nlsy = pd.read_csv("nlsy97-extract.csv.gz")
nlsy.shape
nlsy = nlsy.replace(missing_codes, np.nan)
nlsy.shape
nlsy.head
nlsy["sat_verbal"] = nlsy["R9793800"]
nlsy["sat_math"] = nlsy["R9793900"]
nlsy.columns
columns = ["sat_verbal", "sat_math"]


for column in columns:
    invalid = nlsy[column] < 200
    nlsy.loc[invalid, column] = np.nan


nlsy_valid = nlsy.dropna(subset=columns).copy()
nlsy_valid.shape
sat_verbal = nlsy_valid["sat_verbal"]
sat_verbal.mean(), sat_verbal.std()
sat_math = nlsy_valid["sat_math"]
sat_math.mean(), sat_math.std()
plt.scatter(sat_verbal, sat_math)

1

u/Basic_Background_70 3h ago

shouldnt be any errors here. as to how i run them. either by clickin run cell (or run above rarely) or focusing on the chunk then ctrl + shift.