ipython-notebook

Draw horizontal lines from x=0 to data points in matplotlib scatterplot (horizontal stem plot)

折月煮酒 提交于 2020-06-25 06:03:39
问题 Consider the follwing plot: produced by this function: def timeDiffPlot(dataA, dataB, saveto=None, leg=None): labels = list(dataA["graph"]) figure(figsize=screenMedium) ax = gca() ax.grid(True) xi = range(len(labels)) rtsA = dataA["running"] / 1000.0 # running time in seconds rtsB = dataB["running"] / 1000.0 # running time in seconds rtsDiff = rtsB - rtsA ax.scatter(rtsDiff, xi, color='r', marker='^') ax.scatter ax.set_yticks(range(len(labels))) ax.set_yticklabels(labels) ax.set_xscale('log')

How to fix tqdm progress_apply for pandas in Jupyter?

ε祈祈猫儿з 提交于 2020-06-22 08:46:28
问题 Don't really understand is it a mistake or just my local problem, still have some issues with using tqdm progress bars with progress_apply in Jupyter. First try: from tqdm import tqdm tqdm_notebook.pandas(desc="Example Desc") keywords_df['keyword'] = keywords_df['keywird'].progress_apply(lambda x: x.replace('*','')) Output (without any bars) : AttributeError: 'function' object has no attribute 'pandas' Second try: from tqdm import tqdm tqdm_notebook().pandas(desc="Example Desc") keywords_df[

Format output of code cell with Markdown

泪湿孤枕 提交于 2020-06-10 02:15:40
问题 Output of Python code cell seems to be not processed by Markdown. For example in Python code cell there could be something like that: print "**bold**" And the output is: **bold** instead of bold . Is there a way to make it really bold? 回答1: To get markdown formatted output, you can use the Markdown object of the display machinery. A print-like function could thus look like from IPython.display import Markdown, display def printmd(string): display(Markdown(string)) printmd('**bold**') 来源:

how to insert a link to a local file into a markdown cell?

纵然是瞬间 提交于 2020-05-11 04:03:32
问题 Dear ipython notebook users, I want to insert a link to a local file located in the notebook directory, and no, it is not an image (the only example I've found). I want to insert this link within a markdown cell. When clicked on the link, the file is to be opened with a local application (in this case, a molecule viewer) I've tried to come up with the correct syntax, but no luck. Please, any help is greatly appreciated. 回答1: I want to insert a link to a local file located in the notebook

Best practices for turning jupyter notebooks into python scripts

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-09 17:32:25
问题 Jupyter (iPython) notebook is deservedly known as a good tool for prototyping the code and doing all kinds of machine learning stuff interactively. But when I use it, I inevitably run into the following: the notebook quickly becomes too complex and messy to be maintained and improved further as notebook, and I have to make python scripts out of it; when it comes to production code (e.g. one that needs to be re-run every day), the notebook again is not the best format. Suppose I've developed a

Change Jupyter notebook version 4.x+ logo

会有一股神秘感。 提交于 2020-03-17 11:15:09
问题 In IPython notebook version 2.x , you can add logo by customizing folder .ipython/profile_name/static/base/images/logo.png and it will display the custom logo that we made on the header of the notebook. In Jupyter notebook version 4.x , we know that they move directory to .jupyter/ instead i.e. .jupyter/base/ and .jupyter/custom/custom.css . However, when I try to customize default profile in ~/.jupyter/base/images/logo.png , I couldn't custom the logo anymore. The question is: How to custom

Change Jupyter notebook version 4.x+ logo

房东的猫 提交于 2020-03-17 11:13:30
问题 In IPython notebook version 2.x , you can add logo by customizing folder .ipython/profile_name/static/base/images/logo.png and it will display the custom logo that we made on the header of the notebook. In Jupyter notebook version 4.x , we know that they move directory to .jupyter/ instead i.e. .jupyter/base/ and .jupyter/custom/custom.css . However, when I try to customize default profile in ~/.jupyter/base/images/logo.png , I couldn't custom the logo anymore. The question is: How to custom

Ipython Notebook: Elegant way of turning off part of cells?

依然范特西╮ 提交于 2020-03-17 10:22:05
问题 In my ipython notebook , there is part of cells that serves as preliminary inspection. Now I want to turn it off , since after running it I know the status of the dataset, but I also want to keep it, so other people using this notebook can have this functionality. How can I do it? Is there any example of doing it? I can comment out these cells, but then switching between on and off would be quite laborious. And may not be quite convinent for other people. I can abstract it into a function ,

How can I set the x-axis as datetimes on a bokeh plot?

冷暖自知 提交于 2020-02-26 06:48:30
问题 I'm using bokeh with an ipython notebook. I want to plot a line graph in bokeh using a pandas DataFrame containing datetimes: import pandas as pd from datetime import datetime as dt from bokeh.io import output_notebook from bokeh.charts import Bar, Line, show df = pd.DataFrame(data=[1,2,3], index=[dt(2015, 1, 1), dt(2015, 1, 2), dt(2015, 1, 3)], columns=['foo']) output_notebook() show(Line(df)) However, bokeh uses microseconds! Why is this? How do I fix it? 回答1: As of bokeh 0.12.3, you can

Trigger File Download within iPython Notebook

别等时光非礼了梦想. 提交于 2020-02-21 10:19:06
问题 Given an iPython notebook running on an external server, is there a way to trigger a file download? I would like to either be able to have the notebook be able to initiate the download of a file living on the the external server to the where the notebook is being rendered locally, or perform a direct string dump from the notebook workspace into a text file, downloaded locally. I.E. a powerful and tool would be a Notebook that can query from a database, alter data, and download the query