Is it possible to display pandas styles in an iPython console? The following code in a Jupyter notebook correctly produces In the console I only get Is it possible to achieve a similar result here, or is the style engine dependent on an html frontend? Thanks in advance for any help. Answer I believe that the …
Tag: ipython
Display pandas dataframe using custom style inside function in IPython
In a jupyter notebook, I have a function which prepares the input features and targets matrices for a tensorflow model. Inside this function, I would like to display a correlation matrix with a background gradient to better see the strongly correlated features. This answer shows how to do that exactly how I w…
IPython, “name ‘plt’ not defined”
I recently installed Atom as an IDE on my laptop, for university. I installed Hydrogen as a convenient solution to show some plots on the go. But whenever I run Hydrogen, I get this error: However Matplotlib is working properly when executed normally, and IPython seems to do as well. This is the code I’…
convert jupyter notebook saved as .HTML file back into .IPYNB
Can I convert a Jupyter Notebook saved as .HTML file back into .IPYNB file? The executable original notebooks were lost. The nbconvert docs don’t have anything useful for this case. Currently I have to copy-paste bunch of cells into a new notebook, but this is very tedious and output cells will be lost …
Argparse in iPython notebook: unrecognized arguments: -f
I am trying to pass a .py file to ipython notebook environment. I have never had to deal directly with argparse before. How do I rewrite the main() function? I tried to delete the line of def main(): and keep the rest of the code. But args = parser.parse_args()” returned an error: ipykernel_launcher.py:…
After starting spyder: ImportError: cannot import name ‘quick_guide’
When I start spyder the internal console pops up and gives the following “traceback”: The IPython console works without problems, it is just missing the “introduction text” (python version, help-commands). Can I just ignore this exception or is there a way to fix this manually? Answer …
How to store the result from %%timeit cell magic?
I can’t figure out how to store the result from cell magic – %%timeit? I’ve read: Can you capture the output of ipython’s magic methods? Capture the result of an IPython magic function and in this questions answers only about line magic. In line mode (%) this works: But in cell mode (%…
Jupyter: disable restart kernel warning
I’m using jupyter 4.1.0, and I find myself making frequent use of the “Restart & Run All” feature. Every time I use that button it displays this warning: Is there a way to disable that warning? Answer You can add a cell in your notebook and using the following statements: And the kernel …
How to display full output in Jupyter, not only last result?
I want Jupyter to print all the interactive output without resorting to print, not only the last result. How to do it? Example : I would like to display 3 4 Answer Thanks to Thomas, here is the solution I was looking for:
Passing IPython variables as arguments to bash commands
How do I execute a bash command from Ipython/Jupyter notebook passing the value of a python variable as an argument like in this example: (obviously I want to grep for foo and not the literal string py_var) Answer General solution As suggested by Catbuilts, use {..}: Its behaviour is more predictable than $&#…