Python Forum

Full Version: How to programmatically stop a program in Jupyter Notebook?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

I think the best way to do it would be to read in the data (depending on how much there is) in parts, for example a column at a time. From there you can just use the parts you need in seperate cells. If you want it to stop then just seperate it into different cells. EG:
import pandas as pd
import sys
 
fran = pd.read_csv(r'C:\Users\Mark\Desktop\FrancesMsg.csv',header=None)
 
lang_lib = {}
 
print(fran)
for line in fran:
#    line.lstrip()
    line = str(line)
    print(line)
I've coded in ksh for years. I know what you want. You have a long cell and want to play with just the first piece before you let the rest run, then after a bit of play, you want to "turn on" the rest of the cell... In ksh, you just put the word "exit" on a line by itself and it stops right there and you can play, then take it back out when you're ready to put the rest of the code back in. I also wanted to do this in Jupyter notebook, but couldn't find a command to act like exit in ksh. I think the best way to do this is to split and then later go back and merge your cell into two, then back into 1. Both can be found under the edit menu, not the cell menu, where you might expect to find them.

Never apologize for being new here! In about 2 weeks you'll be an expert with as easy as this stuff is now!

Jim
Mark17,

You could use the edit split to play with the top piece of your cell, then later edit/merge it back together. I did a log of ksh coding and used "exit" all the time this way. I agree that there should be a command like that for Python too. Maybe the interactive mode is the issue there.

jp21in
Pages: 1 2