jupyter-notebook

Slow matplotlib and ipywidgets image refresh

我只是一个虾纸丫 提交于 2021-01-07 01:29:04
问题 I'm trying to scroll through some magnetic resonance slices using plt.show() and ipywidgets interact() function. I've found no problem by slowly moving the slider, but an important delay is found when sliding through the slices a little bit faster. Here below is the code I'm using. def dicom_animation(x, volume): fig = plt.figure(figsize=(8,8)) plt.imshow(volume['slices'][x]['pixel_array'], cmap=plt.cm.gray) interact(dicom_animation, volume = fixed(a), x=IntSlider(round(len(a['slices'])/2,0),

Pylance not working in VSCode Jupyter notebooks

天大地大妈咪最大 提交于 2021-01-07 00:58:27
问题 Pylance works for .py files: But doesn't work with Jupyter .ipynb notebooks: I tried saving the .ipynb - same issue. How can enable Pylance warnings in my notebooks? 回答1: Currently in VSCode, Python files use the code analysis and quick repair functions provided by the extension "Pylance", but Jupyter notebook does not use it. Here is a workaround and you could refer to it: Please use " # %% " in the ".py" file, it will separate the code like Jupyter and code parsing can be used. 回答2: It

How do I create a shortcut to import most used python modules?

夙愿已清 提交于 2021-01-05 10:53:35
问题 I am looking for a way to automatically (or as a shortcut) import a set of python modules in a jupyter notebook so that I don't have to import them every time I create a new notebook I am finding it very repetitive to import these modules to every notebook. The closest thing I could think here is creating a python file and importing that as a module, but I am looking for something more flexible in Jupyter-notebook # Example Code import pandas as pd import numpy as np import matplotlib.pyplot

How to rotate a Contextily basemap in matplotlib and Jupyter notebook

六月ゝ 毕业季﹏ 提交于 2021-01-05 07:25:07
问题 The bounty expires in 7 days . Answers to this question are eligible for a +50 reputation bounty. AlexS1 wants to draw more attention to this question: Desired answer will allow "Plot-A" and "Plot-B" to be rotated 90-degrees or 270-degrees such that the implied north arrow points to the left or right (note default implied north arrow points to top). These subplots also need to correctly plot the Contextily basemap and Geopandas geodataframe. Thanks in advance for help. I am making a set of

Jupyter notebook: hyperlink to locally stored pdf docs stopped working in Chrome

限于喜欢 提交于 2021-01-03 06:08:50
问题 I have a large number of Jupyter Notebooks and in many of them I have hyperlinks to locally stored pdf documents. A short while ago the links stopped working on my iMac in Chrome. When clicking on a link, a new tab is opened with the proper address, but the page is just black. When I do this on my MacBook with exactly the same Jupyter Notebook, it works ok. I have basically the same environment on my MacBook as on my iMac. Everything is up to date. I am using Anaconda for Python and Jupyter.

Jupyter notebook: hyperlink to locally stored pdf docs stopped working in Chrome

人走茶凉 提交于 2021-01-03 06:04:21
问题 I have a large number of Jupyter Notebooks and in many of them I have hyperlinks to locally stored pdf documents. A short while ago the links stopped working on my iMac in Chrome. When clicking on a link, a new tab is opened with the proper address, but the page is just black. When I do this on my MacBook with exactly the same Jupyter Notebook, it works ok. I have basically the same environment on my MacBook as on my iMac. Everything is up to date. I am using Anaconda for Python and Jupyter.

AttributeError: module 'seaborn' has no attribute 'histplot'

随声附和 提交于 2021-01-02 12:52:06
问题 I'm trying to plot using sns.histplot on the Titanic Dataset in Kaggle's Jupyter Notebook. This is my code: sns.histplot(train, x = "Age", hue="Sex") But it's throwing me this error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-11-d14c3b5a0670> in <module> ----> 1 sns.histplot(train, x = "Age", hue="Sex") AttributeError: module 'seaborn' has no attribute 'histplot' I have made sure to import seaborn

AttributeError: module 'seaborn' has no attribute 'histplot'

限于喜欢 提交于 2021-01-02 12:52:05
问题 I'm trying to plot using sns.histplot on the Titanic Dataset in Kaggle's Jupyter Notebook. This is my code: sns.histplot(train, x = "Age", hue="Sex") But it's throwing me this error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-11-d14c3b5a0670> in <module> ----> 1 sns.histplot(train, x = "Age", hue="Sex") AttributeError: module 'seaborn' has no attribute 'histplot' I have made sure to import seaborn

nbconvert: exporting to another directory?

一个人想着一个人 提交于 2021-01-02 06:47:30
问题 I'm wondering if it's possible to export a Jupyter notebook to a different directory than the same directory as the notebook itself? I'm using this to build HTML versions of the notebooks, and I'd like them to reside under docs/ in my GitHub repo (this is to take advantage of GH-pages). 回答1: NBConvert's --output-dir argument does this: https://nbconvert.readthedocs.io/en/latest/install.html You can use it from the command line or from within a Jupyter notebook. Command line: jupyter nbconvert

Installing Anaconda on Server

烂漫一生 提交于 2020-12-30 03:47:31
问题 I have a Unix server where I have Python3 installed. I ssh to the server from my mac. I was wondering if it possible to install Anaconda and Jupyter (will come with Anaconda) on the server so that I can just pull up Jupyter on the server terminal and run codes on jupyter running on the server. Is it possible? And if yes, could someone guide me to the right link? 回答1: in a terminal on your remote server: #download anaconda (change version if you want) wget https://repo.continuum.io/archive