jupyter-notebook

Plotly in Jupyter issue

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-01 08:45:26
问题 I installed plotly.py to work some plots using Jupyter but I cannot import it. ! pip install plotly --upgrade Requirement already up-to-date: plotly in c:\python34\lib\site-packages Requirement already up-to-date: requests in c:\python34\lib\site-packages (from plotly) Requirement already up-to-date: six in c:\python34\lib\site-packages (from plotly) Requirement already up-to-date: pytz in c:\python34\lib\site-packages (from plotly) Cleaning up... and then import plotly ----------------------

Really confused with Jupyter Notebook, Lab, extensions, and ipywidgets

你说的曾经没有我的故事 提交于 2020-01-01 08:24:27
问题 I want to create an interactive JupyterLab Notebook application, and I need to create a series of custom Widgets. So I started looking into this matter, and the more I look the more confused I become. To make things simple I will ask a bunch of simple questions: One of the most common ways to use widgets on Jupyter Notebooks is to use the ipywidgets library. Right? Unlike the classic Notebook, the Notebook of JupyterLab cannot render JavaScript directly. As a result, the tutorials about

Really confused with Jupyter Notebook, Lab, extensions, and ipywidgets

元气小坏坏 提交于 2020-01-01 08:24:09
问题 I want to create an interactive JupyterLab Notebook application, and I need to create a series of custom Widgets. So I started looking into this matter, and the more I look the more confused I become. To make things simple I will ask a bunch of simple questions: One of the most common ways to use widgets on Jupyter Notebooks is to use the ipywidgets library. Right? Unlike the classic Notebook, the Notebook of JupyterLab cannot render JavaScript directly. As a result, the tutorials about

How to check if you are in a Jupyter notebook

醉酒当歌 提交于 2020-01-01 07:55:09
问题 I am creating a python module with a function to display a pandas DataFrame ( my_df ). If the user imports the module into a Jupyter notebook, I would want to deliver "pretty" formatting for the DataFrame by using something like: from IPython.display import display, HTML display(my_df) If the user is not in a Jupyter notebook, I would want to display the text form of the DataFrame: print(my_df) How can I check if the code is being run from a Jupyter notebook? Or, how can I display the

Pandas DataFrames in Jupyter: columns of equal width and centered

家住魔仙堡 提交于 2020-01-01 07:03:09
问题 Am using Jupyter Notebooks and would like to display a pandas DataFrame applying the same width to all the columns, with all values centered. What's the simplest way to achieve this, without importing libraries? import pandas as pd raw_data = {'regiment': ['Nighthawks', 'Dragoons'], 'company': ['1st', '2nd'], 'name': ['Miller', 'Jacob'], 'preTestScore': [4, 24], 'postTestScore': [25, 94]} df = pd.DataFrame(raw_data, columns = ['regiment', 'company', 'name', 'preTestScore', 'postTestScore'])

Why does keras model predict slower after compile?

白昼怎懂夜的黑 提交于 2020-01-01 01:32:08
问题 In theory, the prediction should be constant as the weights have a fixed size. How do I get my speed back after compile (without the need to remove optimizer)? See associated experiment: https://nbviewer.jupyter.org/github/off99555/TensorFlowExperiments/blob/master/test-prediction-speed-after-compile.ipynb?flush_cache=true 回答1: ULTIMATE CULPRIT : self._experimental_run_tf_function = True . It's experimental. But it's not actually bad. To any TensorFlow devs reading: clean up your code . It's

How do I install Python packages in Google's Colab?

こ雲淡風輕ζ 提交于 2019-12-31 17:37:32
问题 In a project, I have e.g. two different packages, How can I use the setup.py to install these two packages in the Google's Colab, so that I can import the packages? 回答1: You can use !setup.py install to do that. Colab is just like a Jupyter notebook. Therefore, we can use the ! operator here to install any package in Colab. What ! actually does is, it tells the notebook cell that this line is not a Python code, its a command line script . So, to run any command line script in Colab, just add

Turn Off Autosave in IPython Notebook

爷,独闯天下 提交于 2019-12-31 12:06:32
问题 I'm looking for a way to turn OFF autosave in iPython notebook. I've seen references via Google/Stack Overflow searches on how to turn ON autosave but I want the opposite (to turn OFF autosave). It would be preferential if this was something that could be set permanently rather than at the top of each notebook. 回答1: If you add this to your custom.js , it will disable autosave for all notebooks: $([IPython.events]).on("notebook_loaded.Notebook", function () { IPython.notebook.set_autosave

Turtle does not run more than once in jupyter notebook

不羁的心 提交于 2019-12-31 05:50:50
问题 I am trying to run some turtle code in jupyter notebook. When I run the code once, the code runs fine. However, if I run the code again, Python Turtle Graphics freezes and closes (aka python turtle graphics is not responding) and the jupyter notebook's kernel crashes I have tried to switch notebooks, reinstalling jupyter and restarting the kernel, but none of them worked. Here is the turtle code: import turtle pen = turtle.Pen() window = turtle.Screen() pen.color("light blue") pen.shape(

Saving the output of a cell in jupyter notebook with a new line after each number

时光毁灭记忆、已成空白 提交于 2019-12-31 05:46:07
问题 I saved output of a cell as a txt file as follows: First cell: %%capture cap --no-stderr print(q) Second cell: with open('output.txt', 'w') as f: f.write(cap.stdout) Below is a small piece of code that I wanted to save: #%% np.seterr(over='ignore') a = np.uint32(1664525) c = np.uint32(1013904223) seed = np.uint32(1) rng = LCG(seed, a, c) q = [rng.next() for _ in range(0, 2500000)] The file is saved, however the generated numbers are separated by a comma, but I want each generated number to be