ipython

Run jupyter notebook in incognito window

五迷三道 提交于 2019-12-11 00:47:26
问题 On executing the command jupyter notebook , notebook opens on Mozilla Firefox. How to open notebook on incognito mode of Mozilla Firefox from command line? 回答1: Typically Jupyer opens on http://localhost:8888 all you need to do is copy that url and open it yourself in an incognito Firefox session. 回答2: In your config add the following to set the default browser to a private firefox (adapted from here and parameters from there): jupyter_notebook_config.py [...] ## Specify what command to use

Invoke the editor in the interactive mode

放肆的年华 提交于 2019-12-11 00:43:49
问题 When open an editor within Ipython, I usually issue commands In [13]: subprocess.run('vim Person.py', shell=True) Out[13]: CompletedProcess(args='vim Person.py', returncode=0) How to do it in a straight-forwards method? 回答1: The %edit magic command is the canonical way offered by IPython. It invokes an editor specified by $EDITOR , optionally loading a specified file, and executes the code after it's closed. Another common workflow is to have editor and console open in different windows and

How to define the default value of a Slider widget on ipywidgets?

谁说胖子不能爱 提交于 2019-12-11 00:34:57
问题 On a Jupyter Notebook and using ipywidgets I can create sliders using the compact version import ipywidgets as ip def f(x): print(x) ip.interact(f, x = (0, 1, 1)) The slider's default value is 0 but I would like to make it 1. How can I do this? 回答1: The widget abbreviations (using tuples to request sliders, etc.) only expose a small subset of the options that can be passed to a widget. Default values come from the default value in the function definition if available, or the center of the

How to render two pd.DataFrames in jupyter notebook side by side?

旧巷老猫 提交于 2019-12-10 22:29:45
问题 Is there an easy way to quickly see contents of two pd.DataFrames side-by-side in Jupyter notebooks? df1 = pd.DataFrame([(1,2),(3,4)], columns=['a', 'b']) df2 = pd.DataFrame([(1.1,2.1),(3.1,4.1)], columns=['a', 'b']) df1, df2 回答1: The closest to what you want could be: > df1.merge(df2, right_index=1, left_index=1, suffixes=("_1", "_2")) a_1 b_1 a_2 b_2 0 1 2 1.1 2.1 1 3 4 3.1 4.1 It's not specific of the notebook, but it will work, and it's not that complicated. Another solution would be to

prevent overlapping bars using seaborn with pandas plotting

☆樱花仙子☆ 提交于 2019-12-10 22:24:18
问题 I am trying to use pandas plotting to create a stacked horizontal barplot with a seaborn import. I would like to remove space between the bars, but also not have the bars overlap. This is what I've tried: import pandas as pd import numpy as pd import seaborn as sns df = pd.DataFrame(np.random.rand(15, 3)) df.plot.barh(stacked=True, width=1) This seems to work without importing seaborn, though I like the seaborn style and it is usually an import in the ipython notebook I am working in is this

What else can I do to troubleshoot a package not importing in python yet imports in ipython while in a virtualenv?

微笑、不失礼 提交于 2019-12-10 21:58:30
问题 I am a Python enthusiast who decided to get serious about creating some of my own reusable packages. Synopsis of my problem: Calling python test_dummy.py fails to import a package eforest . An ImportError is thrown. import eforest in the python interpreter and in the ipython interpreter both throw no exceptions. Calling run test_dummy.py within the ipython interpreter throws no exception. All cases are run inside of a virtualenv. virtualenv has nothing to do with my problem. I have posted a

how to add a jar to python notebook on bluemix spark?

本秂侑毒 提交于 2019-12-10 21:43:09
问题 I would like to use spark jdbc with python. First step was to add a jar: %AddJar http://central.maven.org/maven2/org/apache/hive/hive-jdbc/2.0.0/hive-jdbc-2.0.0.jar -f However, the response: ERROR: Line magic function `%AddJar` not found. How can I add JDBC jar files in a python script? 回答1: Presently, this is not possible only from a python notebook; but it is understood as an important requirement. What you can do until this is supported, is from the same spark service instance of your

What is required to use ipython in ironpython?

妖精的绣舞 提交于 2019-12-10 21:29:59
问题 I'd love to use IronPython to explore the .net runtime and libraries, but coming from CPython I miss IPython's completion and shortcuts. Last time I checked IPython couldn't be used due to a lack of sys.getframe, but the latest beta versions included support for it. Is there anything lacking? Can one start to use IPython with IronPython, and if so, what must one do? 回答1: There were some issues in 2.6 Beta 1 which prevented it from work - see http://lists.ironpython.com/pipermail/users

IPython's history-search-backward not working as desired

寵の児 提交于 2019-12-10 20:35:59
问题 IPython's history-search-backward feature is one of my favorite features. history-search-backward allows you to type part of a command and then search backward through your readline history for commands that began with that part of the command. By default (I believe) these are bound to UpArrow or Ctrl + P and DownArrow or Ctrl + N (for backward and forward respectively). They are not working for me. Instead they just go linearly through my history instead of taking into account the characters

Control-C kills Ipython in git bash on Windows 7

北城余情 提交于 2019-12-10 20:17:50
问题 After so many years cruising on Linux, I am back on a freaking Windows environment. I use Ipython, and I launch it in git bash. It would be hard for me to use something else, since the environment is configured to use this at my office. So, when I launch Ipython, and I mistakenly launch an infinite loop, or some bad code that takes ages to execute, I use ctrl-c. This kills Ipython, and it's pretty annoying. I did not find any way to circumvene this or another key that would do the trick. Any