Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:54
    savire commented #5318
  • May 12 23:57
    kevin-bates commented #6057
  • May 12 19:32
    soichih commented #5318
  • May 12 18:41
    blink1073 labeled #6059
  • May 12 18:40
    blink1073 edited #6059
  • May 12 18:40
    blink1073 commented #6059
  • May 12 18:39
    blink1073 milestoned #6059
  • May 12 18:39
    blink1073 converted_to_draft #6059
  • May 12 18:39

    blink1073 on changelog-52eebfd0b35111ebbeada325b9a5b7aa

    Automated Changelog Entry for 6… (compare)

  • May 12 18:39
    blink1073 opened #6059
  • May 12 18:34
    blink1073 commented #6058
  • May 12 18:24

    blink1073 on master

    Publish 6.4.0rc0 SHA256 hashes… Bump to 6.4.0.dev0 (compare)

  • May 12 18:24

    blink1073 on v6.4.0rc0

    (compare)

  • May 12 18:17

    blink1073 on changelog-e805f238b34b11ebaec5ffd2a9ab87f8

    (compare)

  • May 12 18:17

    blink1073 on master

    Automated Changelog Entry for 6… (compare)

  • May 12 18:17
    blink1073 closed #6058
  • May 12 18:00
    blink1073 labeled #6058
  • May 12 18:00
    blink1073 milestoned #6058
  • May 12 18:00

    blink1073 on changelog-e805f238b34b11ebaec5ffd2a9ab87f8

    Automated Changelog Entry for 6… (compare)

  • May 12 18:00
    blink1073 opened #6058
Min RK
@minrk
Or do you mean spawning the loop into a background thread so it is still printing when you run other cells?
boris
@pkarpesis:chat.avlikos.gr
[m]
for i in range(0,2):
    print(i)

# Output:
0
1
output 0 and 1 should be printed on separate cells
Min RK
@minrk
Just in general, every output should create a new cell?
Maybe let's step back a bit: why do you want the cell that produces output to be disconnected from the output it creates? What is the goal of the extra output-only cells?
boris
@pkarpesis:chat.avlikos.gr
[m]
Sure let me explain
I have a very large excel file read into a dataframe. On this df there is a column that I am getting its unique values. Then I filter the dataframe based on other conditions for each unique value on that column. Using a for loop I have all output on one cell. Minimizing this output collapses all unique cases of the wanted column where I would like to minimize those one by one
makes sense?
Min RK
@minrk
ok, so the goal is separately collapsible outputs
boris
@pkarpesis:chat.avlikos.gr
[m]
yeap
Min RK
@minrk
That does make sense. I don't think separate cells would be the way to do it, rather producing output that can itself be collapsed.
boris
@pkarpesis:chat.avlikos.gr
[m]
is there a way to do something like this ?
Min RK
@minrk
I was checking if the OutputWidget supported per-outputarea capture. I'm not sure it does
But that's the kind of thing I think would work best
boris
@pkarpesis:chat.avlikos.gr
[m]
will try the OutputWidget @minrk ! really appreciate your help !
Min RK
@minrk
Googling, I think maybe jupyter-widgets/ipywidgets#1926 is getting close to what I was thinking of
boris
@pkarpesis:chat.avlikos.gr
[m]
ah will definetely check accordion
Min RK
@minrk
Try something like this:
from ipywidgets import Output, VBox, Accordion

outputs = []

for i in range(5):
    out = Output()
    outputs.append(out)
    with out:
        print(i)

VBox([Accordion([out]) for out in outputs])
That creates individually collapsible outputs, like:
Screen Shot 2021-03-01 at 14.43.19.png
boris
@pkarpesis:chat.avlikos.gr
[m]
this is very nice ! let me check
Min RK
@minrk
The with out: does the output-capturing to put any output produced during the block into an Output widget; the Accordion makes it collapsible; the VBox lets you display a list of them all together.
Or with a bit more labeling (taken from that issue) and collapsed by default:
from ipywidgets import Output, VBox, Accordion

accordions = []

for i in range(5):
    out = Output()
    # selected_index=None means start collapsed
    accordion = Accordion([out], selected_index=None)
    accordions.append(accordion)
    # give each one a title so they are easier to identify when collapsed
    accordion.set_title(0, f"Outputs for {i}")
    with out:
        for j in range(10):
            print(i, j)

VBox(accordions)
Screen Shot 2021-03-01 at 14.49.29.png
boris
@pkarpesis:chat.avlikos.gr
[m]
guess I have to manually enable widgets first
do I need something like this : https://stackoverflow.com/a/49613135/3058542 ?
boris
@pkarpesis:chat.avlikos.gr
[m]
the output is amazing @minrk ! exactly what I wanted !
boris
@pkarpesis:chat.avlikos.gr
[m]
tried to refactor this a bit and now I have :
def to_accordion(content,title):
    out = Output()
    accordion = Accordion([out], selected_index=None)
    accordion.set_title(0, title)
    with out:
        display(content)
    return VBox([accordion])

so now this works:

to_accordion(some_content,'some_title')

However having this in a for loop does not output anything. For example:

for i in range(3):
    to_accordion(i,i)
Do I have to output this in a different way in Jupyter maybe?
Min RK
@minrk
You need to call display on the result
boris
@pkarpesis:chat.avlikos.gr
[m]
Ah you are right!!
let me try
🎉
great help here @minrk ❤️
boris
@pkarpesis:chat.avlikos.gr
[m]
please forgive my ignorance but if I want to re-run a cell and all the cells below it , I mark all the cells with Shift + End (starting from the cell I want to re-run) and hit ctrl+Enter . There must a better way right ?
Michael Jahn
@aktsizr:matrix.org
[m]
hello. i'm trying to persist some value programmatically directly into the notebook. is this somehow possible? using %store et. al. wouldn't work as this is using the global namespace of the kernel, i guess. my goal is to carry that notebook around and be able to execute it w/ the serialized (once agreed upon and saved) parameters
thought there should be some programmable way to add something to the nb's metadata using get_ipython() or something
Min RK
@minrk
The kernel doesn't generally have access to any information about the document. The simplest way to 'store' such things as input variables is as assignments in a code cell
See some tools like nbparametrize that attempt to automate this process
epifanio
@epifanio

Hi, I am running a jupyter server via conda, on a system that has also other jupyter installations.
How can I avoid my conda-jupyter to pick-up the system kernels ?
jupyter path shows me:

massimods@r740-5hdn2s2-ag-gcompute:~$ which jupyter
/modules/centos7/user-apps/fou-fd/miniconda-mds/envs/rapids-0.19/bin/jupyter
massimods@r740-5hdn2s2-ag-gcompute:~$ jupyter --paths
config:
    /home/massimods/.jupyter
    /modules/centos7/user-apps/fou-fd/miniconda-mds/envs/rapids-0.19/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/massimods/.local/share/jupyter
    /modules/centos7/user-apps/fou-fd/miniconda-mds/envs/rapids-0.19/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/massimods/.local/share/jupyter/runtime

I'd like to avoid to load all the system directory: /usr/local and /usr/share
Is it something that I can tune in the jupyter configuration?

massimods@r740-5hdn2s2-ag-gcompute:~$ jupyter kernelspec list
Available kernels:
  rapids     /home/massimods/.local/share/jupyter/kernels/rapids
  python3    /modules/centos7/user-apps/fou-fd/miniconda-mds/envs/rapids-0.19/share/jupyter/kernels/python3
  bash       /usr/local/share/jupyter/kernels/bash
  ir         /usr/local/share/jupyter/kernels/ir
  python2    /usr/local/share/jupyter/kernels/python2
epifanio
@epifanio
boris
@pkarpesis:chat.avlikos.gr
[m]
Can someone help me enable horizontal scrolls to this :
from IPython.display import display
from ipywidgets import Output, VBox, Accordion, Layout

layout = Layout(border='solid blue')


def to_accordion(content, title):
    out = Output()
    accordion = Accordion([out], selected_index=None, layout=layout)
    accordion.set_title(0, title)
    with out:
        display(content)
    return VBox([accordion])


if __name__ == '__main__':
    to_accordion('test_content', 'test_title')
layout = Layout(border='solid blue', overflow_x='auto') didn't help
Matt Riedemann
@mriedem
Anyone know if this is a place to ask questions about nbconvert or is there a different place for that (in gitter)?
1 reply
Martin K. Scherer
@marscher
Is the rich display system not implemented for JSON rendering in notebook, but only in jupyterlab?
Here is the full description jupyter/notebook#5446
Martin K. Scherer
@marscher
OK, the displaying is done by this extension, which is only available for jupyterlab: https://github.com/jupyterlab/jupyterlab/tree/master/packages/json-extension Do you think this could be ported for jupyter notebook as well?