Python Forum
How to programmatically stop a program in Jupyter Notebook?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to programmatically stop a program in Jupyter Notebook?
#11
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)
while dad_has_cigs == True:
    happiness = True
    if dad_has_cigs == False:
    print("Dad come home!")
    happiness = not happiness
    break
Reply
#12
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how come i can't stop program Shi_Shi_Shi_Shi 4 614 Nov-16-2023, 06:20 PM
Last Post: deanhystad
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,029 Nov-15-2023, 06:56 PM
Last Post: jst
  Navigating file directories and paths inside Jupyter Notebook Mark17 5 711 Oct-29-2023, 12:40 PM
Last Post: Mark17
Question How create programmatically variables ? SpongeB0B 6 1,321 Aug-19-2023, 05:10 AM
Last Post: SpongeB0B
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 944 Jan-21-2023, 05:01 PM
Last Post: nicholas
  Create Excel Line Chart Programmatically dee 3 1,191 Dec-30-2022, 08:44 PM
Last Post: dee
  Graphs from Jupyter notebook to word Scott 0 888 Nov-28-2022, 06:16 AM
Last Post: Scott
  Opening an empty Jupyter notebook in VSCODE Krischu 3 1,848 Mar-09-2022, 01:57 PM
Last Post: Larz60+
  How to do line continuation in Jupyter Notebook? Mark17 4 5,501 Sep-22-2021, 04:22 PM
Last Post: ibreeden
  Jupyter Notebook as IDE bytecrunch 0 1,608 Sep-12-2021, 07:41 PM
Last Post: bytecrunch

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020