jupyter-notebook

Way to extract pickles coming in and out of ipython / jupyter notebook

戏子无情 提交于 2019-12-11 07:33:10
问题 I'm trying to summarize a data analysis project which runs across many ipython / jupyter notebooks and each notebook is fairly long. One of the things that would help this process is if I knew at least what the overall "input" pickles going in and "output" pickles going out. What's the cleanest/quickest/most efficient way to do this? 回答1: I'm not sure if this is the best way to do it, but it's at least one way... def summerize_pickles(notebook_path): from IPython.nbformat import current as

Can't install pyproj module in Google Datalab Jupyter notebook

让人想犯罪 __ 提交于 2019-12-11 07:11:39
问题 I'm trying to install pyproj within a Google Datalab Jupyter notebook as a required dependency for the basemap library. I've tried two methods, needless to say neither has worked. Method 1: Cloning from git !git clone https://github.com/jswhit/pyproj.git Outputs: Cloning into 'pyproj'... remote: Counting objects: 2811, done. remote: Total 2811 (delta 0), reused 0 (delta 0), pack-reused 2810 Receiving objects: 100% (2811/2811), 5.65 MiB | 1.55 MiB/s, done. Resolving deltas: 100% (1951/1951),

Webcam can not show picture with OpenCV in python 3.7

大憨熊 提交于 2019-12-11 06:47:36
问题 I use the following code copied from opencv website : import cv2 cap = cv2.VideoCapture(0) while(True): # Capture frame-by-frame ret, frame = cap.read() cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows() But the image is black with some white noise : I am pretty sure the problems is not come from my webcam device because I use "camera" APP in Windows 10, the picture can display well. The following is my python environment : Python : 3.7

Python Animation

允我心安 提交于 2019-12-11 06:35:48
问题 I tried to program something similar to what the person in this thread programed: Matplotlib Animation His code does work for me very fine considering the proposed fix but when I tried to program something similar the animation somehow does not work in jupyter notebook for me. (If I download it as a .py it works fine) I think its very weird that it works as a .py but not in jupyter, especially considering that the code example in the link above also does work in jupyter notebook for me. My

Enable white frames on matplotlib figure/ Disable transparent frames

↘锁芯ラ 提交于 2019-12-11 06:34:30
问题 I'm running ipython notebook on a dark theme. When I build a chart on this, the chart is white, but the frame is transparent (hence dark), hiding the ticks which are also dark. Is there a way to make the frame not transparent/ white? The ticks are barely visible due to black background. How do I solve this? Thanks! Edit: This is not about changing the colors of axis, ticks/labels, I'm thinking of adding a white background frame, not changing the colors of ticks - it'll be ugly if I just

Jupyter Notebook's terminal command not using correct conda environment

旧城冷巷雨未停 提交于 2019-12-11 06:32:41
问题 I have 2 conda environments installed: - env1 : base environment where jupyter-notebook is installed and started from - env2 : project environment with ipykernel installed I manually added kernelspecs for the 2 environments following this guide. Everything works fine. sys.executable in 2 kernels show separate, correct paths. But for terminal commands (i.e. !which python ), no matter which kernel I'm running in the environment defaults to env1 . Is there any way to have the notebook

pandas converting a float remove exponents

元气小坏坏 提交于 2019-12-11 06:29:10
问题 I have data that looks like this: Date MBs GBs 0 2018-08-14 20:10 32.00 MB 0.00 GB 1 2018-08-14 20:05 4.00 MB 0.00 GB 2 2018-08-14 20:00 1000.99 MB 1.23 GB I stripped away the MB and GB by doing this: df['MBs']=df['MB'].str.strip('MB') df['GBs']=df['GB'].str.strip('GB') Then converted the number to a float and got the totals: df['MBs'] = df['MBs'].astype('float') df['GBs'] = df['MBs'].astype('float') df.loc['Total', ['MBs', 'GBs']] = df.sum() But when I run it my data has exponents Date Data

sys.stdout.flush not work in jupyter notebook

流过昼夜 提交于 2019-12-11 06:27:16
问题 So I only want to re-run code from this repo: https://github.com/dennybritz/reinforcement-learning/blob/master/MC/MC%20Prediction%20Solution.ipynb My focus is on the print's part: for i_episode in range(1, num_episodes + 1): # Print out which episode we're on, useful for debugging. if i_episode % 1000 == 0: print "\rEpisode {}/{}.".format(i_episode, num_episodes) sys.stdout.flush() He is using sys.stdout.flush() to create a simple "progress" output. You can see the output from his repo it

How to export and preserve linked Jupyter notebooks?

让人想犯罪 __ 提交于 2019-12-11 06:25:43
问题 I have multiple Jupyter notebooks that are linked to one another such that Notebook1.ipydb contains a link to Notebook2.ipydb with the markdown [Notebook2](Notebook2.ipynb) and vice versa. When exporting all notebooks to HTML via nbconvert , the link to Notebook2.ipynb is preserved. I would like to change that link to the exported Notebook2.html so the linked HTML files function as a static website. I tried to detect if I was running in iPython using get_ipython().__class__.__name__ , but it

Showing several figures at once

本小妞迷上赌 提交于 2019-12-11 06:25:13
问题 Consider a list of matplotlib figures called a . I try to draw them at once writing in the cell of jupyter notebook something like import matplotlib.pyplot as plt %matplotlib inline for fig in a: fig.show() However I can't get any figures drawn in the cell output. Writing plt.show() inside the loop or after is useless. How can I do this correctly? 回答1: An option might be to use display to display the figures: from IPython.core.display import display for fig in a: display(fig) 来源: https:/