ipython-notebook

How do I run Python asyncio code in a Jupyter notebook?

How do I run Python asyncio code in a Jupyter notebook? Question: I have some asyncio code which runs fine in the Python interpreter (CPython 3.6.2). I would now like to run this inside a Jupyter notebook with an IPython kernel. I can run it with import asyncio asyncio.get_event_loop().run_forever() and while that seems to work …

Total answers: 4

How to do superscripts and subscripts in Jupyter Notebook?

How to do superscripts and subscripts in Jupyter Notebook? Question: I want to to use numbers to indicate references in footnotes, so I was wondering inside of Jupyter Notebook how can I use superscripts and subscripts? Asked By: PraveenHarris || Source Answers: You can do this inside of a markdown cell. A markdown cell can …

Total answers: 5

Password protect a SPECIFIC Jupyter notebook

Password protect a SPECIFIC Jupyter notebook Question: The docs describe how to create a password to protect your jupyter notebooks. I would like to be able to create and share a particular notebook with a special password for just that notebook. Is this possible? Asked By: abalter || Source Answers: No, it is not possible. …

Total answers: 2

Price column object to int in pandas

Price column object to int in pandas Question: I have a column called amount with holds values that look like this: $3,092.44 when I do dataframe.dtypes() it returns this column as an object how can i convert this column to type int? Asked By: kwashington122 || Source Answers: You can set it to Int by: …

Total answers: 19

PySpark in iPython notebook raises Py4JJavaError when using count() and first()

PySpark in iPython notebook raises Py4JJavaError when using count() and first() Question: I am using PySpark(v.2.1.0) in iPython notebook (python v.3.6) over virtualenv in my Mac(Sierra 10.12.3 Beta). 1.I launched iPython notebook by shooting this in Terminal – PYSPARK_PYTHON=python3 PYSPARK_DRIVER_PYTHON=ipython PYSPARK_DRIVER_PYTHON_OPTS=”notebook” /Applications/spark-2.1.0-bin-hadoop2.7/bin/pyspark 2.Loaded my file to Spark Context and ensured its loaded- >>>lines = sc.textFile(“/Users/PanchusMac/Dropbox/Learn_py/Virtual_Env/pyspark/README.md”) …

Total answers: 4

How to copy/paste a dataframe from iPython into Google Sheets or Excel?

How to copy/paste a dataframe from iPython into Google Sheets or Excel? Question: I’ve been using iPython (aka Jupyter) quite a bit lately for data analysis and some machine learning. But one big headache is copying results from the notebook app (browser) into either Excel or Google Sheets so I can manipulate results or share …

Total answers: 7

Jupyter: can't create new notebook?

Jupyter: can't create new notebook? Question: I have some existing Python code that I want to convert to a Jupyter notebook. I have run: jupyter notebook Now I can see this in my browser: But how do I create a new notebook? The Notebook link in the menu is greyed out, and I can’t see …

Total answers: 9

export notebook to pdf without code

export notebook to pdf without code Question: I have a large notebook with a lot of figures and text. I want to convert it to a html file. However, I don’t want to export the code. I am using the following command ipython nbconvert –to html notebook.ipynb But this option also exports the code. Is …

Total answers: 6

PuLP not printing output on IPython cell

PuLP not printing output on IPython cell Question: I am using PuLP and IPython/Jupyter Notebook for a project. I have the following cell of code: import pulp model = pulp.LpProblem(‘Example’, pulp.LpMinimize) x1 = pulp.LpVariable(‘x1′, lowBound=0, cat=’Integer’) x2 = pulp.LpVariable(‘x2′, lowBound=0, cat=’Integer’) model += -2*x1 – 3*x2 model += x1 + 2*x2 <= 7 model += …

Total answers: 2

How to pickle or store Jupyter (IPython) notebook session for later

How to pickle or store Jupyter (IPython) notebook session for later Question: Let’s say I am doing a larger data analysis in Jupyter/Ipython notebook with lots of time consuming computations done. Then, for some reason, I have to shut down the jupyter local server I, but I would like to return to doing the analysis …

Total answers: 3