jupyter-notebook

%matplotlib inline magic command fails to read variables from previous cells in AWS-EMR Jupyterhub Notebook

孤者浪人 提交于 2020-02-02 13:34:18
问题 I'm trying to plot spark dataset using matplotlib after converting it to pandas dataframe in AWS EMR jupyterhub. I'm able to plot in a single cell using matplotlib like below: %matplotlib inline import matplotlib import matplotlib.pyplot as plt df = [1, 1.6, 3, 4.2, 5, 4, 2.5, 3, 1.5] plt.plot(df) Now the above code snippet works pretty neatly for me. After this sample example, I moved ahead to plot my pandas dataframe from a new/multiple cells in AWS-EMR Jupyterhub like this: -Cell 1-

%matplotlib inline magic command fails to read variables from previous cells in AWS-EMR Jupyterhub Notebook

我是研究僧i 提交于 2020-02-02 13:33:20
问题 I'm trying to plot spark dataset using matplotlib after converting it to pandas dataframe in AWS EMR jupyterhub. I'm able to plot in a single cell using matplotlib like below: %matplotlib inline import matplotlib import matplotlib.pyplot as plt df = [1, 1.6, 3, 4.2, 5, 4, 2.5, 3, 1.5] plt.plot(df) Now the above code snippet works pretty neatly for me. After this sample example, I moved ahead to plot my pandas dataframe from a new/multiple cells in AWS-EMR Jupyterhub like this: -Cell 1-

Python doesn't see packages with Jupyter Notebook

一世执手 提交于 2020-02-02 11:41:12
问题 I use Jupyter Notebook with a virtual environment. I have a dependency installed, but can't import it: cell 1: !pip3 install sent2vec Requirement already satisfied: sent2vec in venv/lib/python3.7/site-packages (0.0.0) cell 2: import sent2vec ModuleNotFoundError Traceback (most recent call last) <ipython-input-5-06231d291a17> in <module> ----> 1 import sent2vec ModuleNotFoundError: No module named 'sent2vec' How this can happen? How to fix this? > pip3 list Package Version ------------ -------

Jupyter on EC2: SSL Error

十年热恋 提交于 2020-01-31 18:14:47
问题 I'm trying to serve a Jupyter notebook from EC2 but I'm getting an SSL error. I'm using this AMI: TensorFlow GPU - @nottombrown (ami-8ed4d0e4) . I used a self-signed certificate and that might be part of the problem. I've looked at several other SO posts that have a similar error such as this, this and this, but they're getting the error in a quite different context and I can't figure out how to get the solutions (such as setting verify=False ) to work for me. [E 15:52:44.954 NotebookApp]

graceful interrupt of while loop in ipython notebook

寵の児 提交于 2020-01-31 18:14:37
问题 I'm running some data analysis in ipython notebook. A separate machine collects some data and saves them to a server folder, and my notebook scans this server periodically for new files, and analyzes them. I do this in a while loop that checks every second for new files. Currently I have set it up to terminate when some number of new files are analyzed. However, I want to instead terminate upon a keypress. I have tried try-catching a keyboard interrupt, as suggested here: How to kill a while

graceful interrupt of while loop in ipython notebook

自古美人都是妖i 提交于 2020-01-31 18:14:29
问题 I'm running some data analysis in ipython notebook. A separate machine collects some data and saves them to a server folder, and my notebook scans this server periodically for new files, and analyzes them. I do this in a while loop that checks every second for new files. Currently I have set it up to terminate when some number of new files are analyzed. However, I want to instead terminate upon a keypress. I have tried try-catching a keyboard interrupt, as suggested here: How to kill a while

python3: .strip( ) not working as expected [duplicate]

若如初见. 提交于 2020-01-30 10:49:11
问题 This question already has answers here : Strip function is not working as expected (2 answers) Closed 6 months ago . I am parsing a file and want to strip the word Energy from the lines of the file but using .strip("Energy") doesn't yield the desired result and removed the 'E' of the 'Epoch'. I am probably not using the data types correctly or don't understand .strip() correctly. Please explain why am I getting the output given at the end of this post. I have a file which looks like : Epoch

python3: .strip( ) not working as expected [duplicate]

社会主义新天地 提交于 2020-01-30 10:48:06
问题 This question already has answers here : Strip function is not working as expected (2 answers) Closed 6 months ago . I am parsing a file and want to strip the word Energy from the lines of the file but using .strip("Energy") doesn't yield the desired result and removed the 'E' of the 'Epoch'. I am probably not using the data types correctly or don't understand .strip() correctly. Please explain why am I getting the output given at the end of this post. I have a file which looks like : Epoch

How to pretty print in ipython notebook via sympy?

北慕城南 提交于 2020-01-25 10:12:09
问题 I tried pprint , print , the former only prints Unicode version, and the latter doesn't do pretty prints. from sympy import symbols, Function import sympy.functions as sym from sympy import init_printing init_printing(use_latex=True) from sympy import pprint from sympy import Symbol x = Symbol('x') # If a cell contains only the following, it will render perfectly. (pi + x)**2 # However I would like to control what to print in a function, # so that multiple expressions can be printed from a

Command line python and jupyter notebooks use two different versions of torch

淺唱寂寞╮ 提交于 2020-01-25 07:53:27
问题 On my conda environment importing torch from command line Python and from a jupyter notebook yields two different results. Command line Python: $ source activate GNN (GNN) $ python >>> import torch >>> print(torch.__file__) /home/riccardo/.local/lib/python3.7/site-packages/torch/__init__.py >>> print(torch.__version__) 0.4.1 Jupyter: (GNN) $ jupyter notebook --no-browser --port=8890 import torch print(torch.__file__) /home/riccardo/.local/lib/python3.6/site-packages/torch/__init__.py print