jupyter-notebook

How to make seaborn.heatmap larger (normal size)?

不羁的心 提交于 2019-12-05 18:26:58
问题 I displayed plot with the following command in jupyter notebook: sns.heatmap(pcts, annot=True, linewidth=.1, vmax=99, fmt='.1f', cmap='YlOrRd', square=True, cbar=False) plt.yticks(list(reversed(range(len(indices)))), ['Index '+str(x) for x in indices], rotation='horizontal') plt.title('Percentile ranks of\nsamples\' category spending'); and got the following picture i.e. squares appear unacceptably small. How can I make them larger? 回答1: Before using heatmap() , call matplotlib.pyplot.figure(

How to pass command line arguments in IPython jupyter notebook

无人久伴 提交于 2019-12-05 17:58:54
I a new to Ipython. Currently i have installed Ipython using Anaconda and writing a code to plot chart using jupyter notebook UI. I want to pass few arguments to my working script with the help of argparse module. below is the code.. import argparse parser = argparse.ArgumentParser(description = 'Process display arguments') parser.add_argument('-t', "--test_name", help="Mandatory test name directory path", type=str) parser.add_argument('-s', "--symbolSet", nargs = '?', help="Optional symbolset", const = 'baz', default = 'deafultOne') args = parser.parse_args() if args.test_name is None: print(

How to display matplotlib plots in a Jupyter tab widget?

半城伤御伤魂 提交于 2019-12-05 17:56:58
I am having trouble displaying plots inside of Jupyter tab widgets. Consider the following snippet: import matplotlib.pyplot as plt import pandas as pd import ipywidgets as widgets import numpy as np out1 = widgets.Output() out2 = widgets.Output() data1 = pd.DataFrame(np.random.normal(size = 50)) data2 = pd.DataFrame(np.random.normal(size = 100)) with out1: fig1, axes1 = plt.subplots() data1.hist(ax = axes1) display(fig1) with out2: fig2, axes2 = plt.subplots() data2.hist(ax = axes2) display(fig2) tab = widgets.Tab(children = [out1, out2]) tab.set_title(0, 'First') tab.set_title(1, 'Second')

How to enable timing magics for every cell in Jupyter notebook?

冷暖自知 提交于 2019-12-05 17:45:15
The %%time and %%timeit magics enable timing of a single cell in a Jupyter or iPython notebook. Is there similar functionality to turn timing on and off for every cell in a Jupyter notebook? This question is related but does not have an answer to the more general question posed of enabling a given magic automatically in every cell. A hacky way to do this is via a custom.js file (usually placed in ~/.jupyter/custom/custom.js ) The example of how to create buttons for the toolbar is located here and it's what I based this answer off of. It merely adds the string form of the magics you want to

Include output from %matplotlib notebook backend as SVG in ipynb

妖精的绣舞 提交于 2019-12-05 17:26:03
问题 This answer from a few years ago shows how you can make jupyter notebook create graphs as svg. The solution is to tell the InlineBackend to use svg as output. import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'svg' plt.plot(...) This will cause all images to be in svg format inside the notebook as well as in the produced ipynb file; the file will have a line like "data": { "image/svg+xml": [ "<?xml ..... in it. The problem is now that this does not work

Julia DataFrame output functions

◇◆丶佛笑我妖孽 提交于 2019-12-05 16:56:58
What Julia functions can output a DataFrame so it is converted into text other than the ones shown below? using DataFrames A = DataFrame(randn(10, 7)); print("\n\n\n", "A = DataFrame(randn(10, 7))") print("\n\n\n","print(A)\n") print(A) print("\n\n\n","show(A)\n") show(A) print("\n\n\n","show(A, true)\n") show(A, true) print("\n\n\n","show(A, false)\n") show(A, false) print("\n\n\n","showall(A)\n") showall(A) print("\n\n\n","showall(A, true)\n") showall(A, true) print("\n\n\n","showall(A, false)\n") showall(A, false) print("\n\n\n","display(A)\n") display(A) Most of these output something

How to use nbconvert as git textconv driver to enable effective version control of Jupyter Notebooks

╄→гoц情女王★ 提交于 2019-12-05 16:30:18
问题 What I'm trying to do and how it differs from similar problems I would like to version control Jupyter Notebooks using Git. Unfortunately, by default, Git and Jupyter Notebooks do not play nicely. An .ipynb file is a .json file containing not only the Python code itself but also plenty of metadata (e.g., cell execution counts) and cell output. Most existing solutions (e.g., Using IPython notebooks under version control) rely on removing output and metadata from the notebook. This (i) still

how to display a python string as HTML in jupyter notebook

点点圈 提交于 2019-12-05 14:58:05
问题 In IPython notebook, I used to be able to display a python string that contains html as actual html, by using the HTML function from IPython's display module. from IPython.display import HTML In jupyter notebook the display module no longer exists. Does anyone know where I can find the HTML function? I use Jupyter notebook 4.1, IPython 4.0.2 and Python 3.5.1 64 bit 回答1: Use the function display def bar(): from IPython.display import display, HTML chart = HTML('<h1>Hello, world!</h1>') # or

Keras floods Jupyter cell output during fit (verbose=1)

谁说我不能喝 提交于 2019-12-05 14:34:18
When running keras model inside Jupyter notebook with "verbose=1" option, I started getting not single line progress status updates as before, but a flood of status lines updated at batch. See attached picture. Restarting jupyter or the browser is not helping. Jupyter notebook server is: 5.6.0, keras is 2.2.2, Python is Python 3.6.5 Please help. cell content: history = model.fit(x=train_df_scaled, y=train_labels, batch_size=BATCH_SIZE, epochs=EPOCHS, verbose=1, validation_data=(validation_df_scaled, validation_labels), shuffle=True) output flood example: (it is thousands of lines like this)

How to insert a literal tab instead of auto-completing in Jupyter?

。_饼干妹妹 提交于 2019-12-05 13:39:27
It is easy to indent a whole line. Just highlight the whole line and press Tab Go to the start of the line and press Tab Click anywhere in the line and press Ctrl + ] Now the problem is how to insert indent in the middle of the line. And also, how to indent at the end of the line. Example usage scenario: # Hyperparameters LENGTH = 10 # length of foo TEMP = 20 # temperature of bar IV = 99.99 # induction variability of foo bar Concretely, we want: # Hyperparameters LENGTH = 10 # length of foo TEMP = 20 # temperature of bar IV = 99.99 # induction variability of foo bar Or even better (in some