Menu
  • HOME
  • TAGS

Is there any way to force ipython to interpret utf-8 symbols?

string,utf-8,ipython,literals,diacritics

Your problem is that you are getting two characters for the 'ó' character instead of one. Therefore, try to change it to unicode first so that every character has the same length as follows: def remove_accent(n): n_unicode=unicode(n,"UTF-8") listn = list(n_unicode) for i in range(len(listn)): if listn[i] == u'ó': listn[i] =...

How to run shell-commands in IPython? (Python Profiling GUI tools)

python,shell,profiling,ipython,ipython-magic

From the ipython example in the pyprof2calltree documentation: >>> from pyprof2calltree import convert, visualize >>> visualize('prof.out') >>> convert('prof.out', 'prof.calltree') Or: >>> results = %prun -r x = taylor_sin(500) >>> visualize(results) >>> convert(results, 'prof.calltree') You could also try: >>> %run -m pyprof2calltree -i prof.out -o prof.calltree ...

IPython forward slash documentation

python,ipython

If you type ? in ipython you will get the builtin documentation: You can force auto-parentheses by using '/' as the first character of a line. For example:: In [1]: /globals # becomes 'globals()' Note that the '/' MUST be the first character on the line! This won't work:: In...

How to covert .ipynb to slides using nbconvert?

terminal,ipython,ipython-notebook,google-api-python-client

Adding the following extra option to your code might solve the problem. --reveal-prefix "http://cdn.jsdelivr.net/reveal.js/2.5.0" Hope it helps....

How to run qtconsole connected to ipython3 instance?

ipython,python-3.4,qtconsole

Reposting as an answer: If you just run ipython3 in a terminal, what you get is a pure terminal interface, it's not running a kernel that the Qt console can talk to. If you run ipython3 console, you'll get a similar interface but it will be talking to a kernel,...

Find a null value and drop from a dataframe in Pandas

python,numpy,pandas,ipython

You can keep only the notnull values using a boolean mask: df = df[df["data"].notnull()] ...

How to prevent IPython from activate to the cell below after running a cell?

ipython

Press Ctrl+Enter, instead of Shift+Enter

How to update python 2.7 in HDP 2.2 using with Spark and Python

python,python-2.7,hadoop,ipython

Python is not integrated with the Hadoop system. Python 2.6.6 is the default version for Centos 6.5 / RHEL 6. You should under no circumstances attempt to uninstall/update the default version, because it has system dependencies. What you can do is to install a newer version of python as...

Adding multiple rows in an existing dataframe

python,pandas,ipython

It seems you are trying to filter out an existing dataframe based on indices (which are stored in your variable called comp_rows). You can do this without using loops by using loc, like shown below: In [1161]: df1.head() Out[1161]: A B C D a 1.935094 -0.160579 -0.173458 0.433267 b 1.669632...

Returning to host code in pyCUDA after asynchronous kernel launch

python,python-2.7,cuda,ipython,pycuda

I figured this out, so am posting my solution. Even though asynchronous memcpy's are non-blocking, I discovered that doing a memcpy using the same stream as a running kernel does not work. My solution was to create another stream: strm2 = driver.Stream() and then change d_inShot like so: d_inShot.set_async(h_inShot.astype(np.uint16), stream...

Can I make ipython exit from the calling code?

python,ipython

There's a %kill_embedded command in IPython. It doesn't put you directly back to the shell prompt, but it skips the other embed instances. from IPython import embed for item in range(5): print 'embedding', item embed() And here's the output: $ python my_example_program.py embedding 0 Python 2.7.9 (default, Dec 13 2014,...

Close an open h5py data file

python,ipython,hdf5,h5py

This is how it could be done (I could not figure out how to check for closed-ness of the file without exceptions, maybe you will find): import gc for obj in gc.get_objects(): # Browse through ALL objects if isinstance(obj, h5py.File): # Just HDF5 files try: obj.close() except: pass # Was...

Unable to run ipython-notebook 2.7 with jupyterhub

ipython,ipython-notebook,jupyter

~/.ipython/kernels.json is not the right path. And theses files are not ment to be edited by hand. Also the file you have is not valid json, the server will be unable to read it if it was in the right place. use python2.7 -m IPython kernelspec install-self and python3 -m...

TypeError: __repr__ returned non-string (type bytes)

python,python-3.x,oauth,ipython

This is a bug in the library; the User.__repr__ method returns bytes on Python 3: def __repr__(self): return '<User {0!r} {1!r}>'.format(self.id, self.username).encode('utf-8') You already filed a bug report with the project, which is great! You can avoid the issue you see in IPython or any other interactive Python console by...

IPython IPCluster different path for different nodes

python,ipython,ipython-parallel

I'm thinking the simplest thing to do is to configure the PATH settings on two platforms so that a you don't need to fully specify the path to the python executable in your engine_cmd. If you want to spend a little more time developing, you could mess with ipcluster_config.py as...

How to write an ipython alias which executes in python instead of shell?

python,macros,ipython,alias,ipython-magic

The normal way to do this would be to simply write a python function, with a def. But if you want to alias a statement, rather than a function call, then it's actually a bit tricky. You can achieve this by writing a custom magic function. Here is an example,...

Python class instance not being destroyed at end of method [duplicate]

python,class,garbage-collection,ipython,spyder

Your problem is the way you store the data: Class attributes are stored in the class and shared between all instances of a class. Instance attributes, instead, count per instance. Instead of class Reader: m_headers = [] m_seclist = [] def __init__(self, filename): do class Reader: def __init__(self, filename): self.m_headers...

How to import modules in IPython Clusters

ipython,ipython-notebook,ipython-parallel

It seems that with dview.sync_imports() is being run someplace other than your IPython Notebook environment and is therefore relying a different PYTHONPATH. It is definitely not being run on one of the cluster engines and so wouldn't expect it to leverage your cluster settings of PYTHONPATH. I'm thinking you'll need...

write text file from text files python

python,python-2.7,python-3.x,subprocess,ipython

Here's one way to paste together multiple files in Python. It handles any number of input files, but like Peter's solution if the files have different numbers of lines it stops when the shortest file runs out of lines. Fields in the output file are separated by the delimiter string,...

Troubles after updating ipython (%matplotlib nbagg)

python,matplotlib,ipython,ipython-notebook,jupyter

I guess this issue is caused by a too old version of matplotlib. Using %matplotlib nbagg with ipython>=3.0 requires matplotlib>=1.4.3 (Note that %matplotlib notebook and %matplotlib nbagg are now synonyms). Updating matplotlib via pip install --upgrade matplotlib will probably fix this issue. See also my issue-7797 on github. Thanks to...

Playing with packages in IPython

python,ipython,python-import

Open ipython from inside of the top-level directory of the project, in this case, package/. Then import the modules with absolute imports: import package.module2 as module2 or import package.submodule1.module1 as m1 ...

turtle width and pensize Difference?

python,python-2.7,python-3.x,ipython

There is no difference, turtle.width() is an alias for turtle.pensize(). Here is the docstring shown by help(turtle.pensize): Help on function pensize in module turtle: pensize(width=None) Set or return the line thickness. Aliases: pensize | width Argument: width -- positive number Set the line thickness to width or return it. If...

Ipython storemagic to store all available variables

ipython,storemagic

Reposting as an answer: The %store magic doesn't have an option to save the whole session, but the dill package has a function dump_session() which should do that....

How to prevent IPython notebook script pausing when the screen locks

ipython,ipython-notebook

Well it took a bit of googling, but if it's any help to anyone you can prevent your Mac from going to sleep by opening terminal and typing pmset noidle, which will tell the power management utility to temporarily disable sleep.

“Replot” a matplotlib inline plot in a IPython notebook

python,matplotlib,ipython,visualization,scientific-computing

A: This can be done at a cost of changed matplotlib Renderer Currently, this cannot be done for the IPython "inline" graphs, however, if you opt to change a Renderer part of the matplotlib framework, to another one, the limitation of a singleton call of the .show() method does not...

Custom Keybindings for Ipython terminal

python,keyboard-shortcuts,ipython,key-bindings

Reposting as an answer: You can set InteractiveShell.readline_parse_and_bind in a config file (default value is here). It takes a list of readline config commands. IPython also uses .inputrc, but things in that config value take precendence, and Ctrl+L is in there by default....

IPython notebook does not capture all console output

python,ipython,ipython-notebook

This gives you nice and comprehensive description of your problem and potential solutions. You need to try it out for yourself with your specific setup.

IPython notebook: How to write cell magic which can access notebook variables?

python,ipython,ipython-notebook

Use the @needs_local_scope decorator decorator. Documentation is a bit missing, but you can see how it is used, and contributing to docs would be welcome.

Ipython : Installation error, unable to find _sqlite.so

python,sqlite,python-3.x,sqlite3,ipython

I managed to resolve it thanks to the help I got in the comments. Just putting it here to make it easy for anyone else who may have the same issue to figure out whats going on. The issue is in using a self compiled version of Python, before the...

output_notebook() is not defined - why?

python,ipython,anaconda,bokeh

It looks as if you forgot to import output_notebook. The scatterplot tutorial notebook has following imports: from collections import OrderedDict from bokeh.charts import Scatter from bokeh.sampledata.iris import flowers from bokeh.plotting import * output_notebook() The line from bokeh.plotting import * implicitly pulls the output_notebook function into the namespace....

How to use groupby in Pandas to compute columns

python,numpy,pandas,ipython

To get to your desired table, you basically just have to unstack gpm to move Bracket and Win into the columns: unstacked = gpm.unstack(['Bracket', 'Win']) Then you can use a simple str.join to create strings out of the column levels: new_cols = unstacked.columns.to_series().map( lambda t: '_'.join(str(e) for e in t))...

How to standard-print `dir()` and other calls in Ipython

python,ipython

Just print it: In [1]: print(dir()) ['In', 'Out', '_', '__', '___', '__builtin__', '__builtins__', '__doc__', '__name__', '_dh', '_i', '_i1', '_ih', '_ii', '_iii', '_oh', '_sh', 'exit', 'get_ipython', 'quit'] ...

IPython MPI with a Machinefile

ipython,mpi,distributed-computing

I guess I asked too soon. the problem was in the below line c.MPILauncher.mpi_args = ["-machinefile ~/.ipython/profile_default/machinefile"] It should have been split on the spaces with absolute path c.MPILauncher.mpi_args = ["-machinefile", "/home/aidan/.ipython/profile_default/machinefile"] I hope this can help someone. Note that this solves only the problem in the BASH output. The...

Load local data into IPython notebook server

data,server,ipython

Since you have jupyter installed, all users should see the files/folders in the jupyter startup directory as well as its subdirectory. The new button on the jupyter notebook can be used to create a new file/folder or even a terminal. Files can be uploaded using drag-drop or click here feature...

IPython notebook 2.3.0 on Fedora 21 cannot find FontAwesome

python,ipython,ipython-notebook

I just run into this problem myself today. The file /usr/lib/python2.7/site-packages/IPython/html/static/style/style.min.css of the python-ipython-notebook-2.3.0-1.fc21.noarch package has wrong references to font awesome files. A quick and dirty fix is: cd /usr/lib/python2.7/site-packages/IPython/html/static sudo ln -s components/font-awesome/font fonts It would be best to signal with bug of the python-ipython-notebook in RedHat bugzilla, I...

Why sorted list detection does not work in this situation?

python,list,sorting,ipython

I was able to reproduce a similar problem on my machine. However, after digging, it occurred that the all function was not the built-in function but came from numpy (all.__module__ == 'numpy.core.fromnumeric'). The problem is that you are creating a generator rather than a list. For example: all(x>5 for x...

Why is it possible to call functions using slashes in iPython?

python,ipython,ipython-notebook

This is simply one of the features of ipython. It exists to make it possible to call functions without using the parenthesis. Starting your line with / tells it to treat the first word as a function name, add parenthesis to it, and treat any following words or symbols as...

itorch creates a python console, not a torch console

ipython,torch

iTorch supports iPython v2.3 or above. Please see the required dependencies. You seem to have iPython v 0.1.2, maybe that's a reason you see this behavior.

debugger in ipython is not working

python,debugging,ipython

I figured it out. I need to put the code in a file and run -d xxxx.py. After this the continue works fine! run -d ch03/ipython_bug.py ...

How to call module written with argparse in iPython[notebook]

python,ipython,bioinformatics,biopython,suffix-tree

I've had a similar problem before, but using optparse instead of argparse. You don't need to change anything in the original script, just assign a new list to sys.argv like so: if __name__ == "__main__": from Bio import SeqIO path = '/path/to/sequences.txt' sequences = [str(record.seq) for record in SeqIO.parse(path, 'fasta')]...

How do I inspect one specific object in IPython

python,ipython

The command whos and linemagic %whos are available in IPython, but are not part of standard Python. Both of these will list current variables, along with some information about them. You can specify a type to filter by, e.g. whos Variable Type Data/Info ---------------------------- a list n=3 b int 2...

SublimeREPL and IPython

python,ipython,sublimetext3,sublimerepl

It's solved. I make a file named Main.sublime-menu within the folder Sublime Text 3\Packages\User\SublimeREPL\config\Python [ { "id": "tools", "children": [{ "caption": "SublimeREPL", "mnemonic": "r", "id": "SublimeREPL", "children": [ { "caption": "Python", "id": "Python", "children":[ { "command": "repl_open", "caption": "IPython - Anaconda", "id": "repl_python_ipython", "mnemonic": "p", "args": { "type": "subprocess", "encoding":...

IPython notebook 3 - hide headers by default

customization,ipython,ipython-notebook

add this to custom.css in your profile (e.g. ~/.ipython/profile_default/static/custom/custom.css for me): div#site{ height: 100% !important; } to remove any nasty grey space at the bottom. Also, I add this to my custom.js (same folder) to toggle the header using ctrl-` : $([IPython.events]).on('notebook_loaded.Notebook', function(){ $('#header').hide(); IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-`', function (event) { if (IPython.notebook.mode...

replace loop variable in system shell command of ipython

python,for-loop,ipython,magic-function

For this kind of task you'd use to use the subprocess module; the easiest would be to use the call method with shell=True: from subprocess import call def remove_ambMap(samp): call('samtools view -q 20 -b home/pathToFile/{samp}.realn.bam ' '| samtools sort - {samp}'.format(samp=samp), shell=True) for samp in samples: remove_ambMap(samp) ...

How do I add a kernel on a remote machine in IPython (Jupyter) Notebook?

python,ipython,ipython-notebook,ipython-parallel,jupyter

IPython use kernel is a file in ~/.ipython/kernel/<name> that describe how to launch a kernel. If you create your own kernel (remote, or whatever) it's up to you to have the program run the remote kernel and bind locally to the port the notebook is expected.

Where is the history file for ipython

python,ipython

IPython history is stored in a SQLite database located in the profile directory. By default: ~/.ipython/profile_default/history.sqlite Older versions (1.x) stored profile data in ~/.config/ipython, at least on platforms conforming to XDG basedir specs (i.e. most Linux distributions). Anyway, you can locate the profile directory with: $ ipython locate profile default...

Can't inline Bokeh in IPython

python-2.7,ipython,bokeh

So, i restarted the system a few times, and started a new notebook, and suddenly everything works. i'm guessing the issue was with one of the imports, but i'm not 100% sure. now everything works perfect.

How to Generate Graphs using Python Panda

python,graph,ipython

You could also consider using pandas to read the sheets, and matplotlib to display graphs. http://matplotlib.org/gallery.html

Can't import ggplot module in iPython

ipython,python-ggplot

You probably need to install ggplot via the terminal first. Assuming you already have pip installed, run this in the terminal:$ pip install ggplot You should see the package download. Then go back to your notebook and run your same commands again. ...

How to manage and communicate with multiple IPython/Jupyter kernels from a Python script?

python,ipython,ipython-notebook,jupyter

A KernelManager deals with starting and stopping a single kernel, and there's a MultiKernelManager to co-ordinate more than one. http://ipython.org/ipython-doc/3/api/generated/IPython.kernel.manager.html http://ipython.org/ipython-doc/3/api/generated/IPython.kernel.multikernelmanager.html Then you can use the .client() method to get a KernelClient instance which handles communications with a kernel: http://ipython.org/ipython-doc/3/api/generated/IPython.kernel.client.html For details of how you communicate with a kernel, see...

does IPython Notebook affect speed of the program?

python,numpy,ipython,ipython-notebook

One of the things that might slow things a lot would be if you had a lot of print statements in your simulation. If you run the kernels server and browser on the same machine, assuming your simulation would have used all the cores of your computer, yes using notebook...

ipython - disable welcome message

ipython

Just use: ipython console You'll get it, if that's what you want....

Printing 2 Python Pandas DataFrame in HTML Tables in iPython Notebook

python,pandas,ipython,ipython-notebook

In the IPython notebook, only the result of the last line of a cell is shown, unless it is explicitly printed or displayed. Some options: Put the second df.head() in the next cell Use print df to explicitly print the dataframe -> but, this gives the text representation instead of...

How to persist ipython notebook without persisting output?

django,git,ipython,ipython-notebook,hipaa

Reposting as an answer: You can set up a git hook that will strip the output from the notebook whenever you commit: gist.github.com/minrk/6176788 A bit more advanced, but less tested, is a tool I wrote called nbexplode, that splits the notebook up into multiple pieces and recombines them. The advantage...

Open 'ipython notebook' as: IPython notebook vs Jupyter

ipython,ipython-notebook,jupyter

ipython is now called Jupyter so perhaps a different version of Anaconda is installed on the other computer? So Jupyter is what ipython will continue to develop as - they dropped python as it is basically "agnostic": it can load different languages - python 2 or 3, but also R...

Change default iPython in homebrew to use Python 2.x.x instead of Python 3.x.x

python,python-3.x,ipython,homebrew,jupyter

Ok, I found the answer. Simply copy the ipython2 file to ipython: cp /usr/local/bin/ipython2 /usr/local/bin/ipython ...

IPython Notebook: How to combine HTML output and matplotlib figures?

python,html,matplotlib,ipython,ipython-notebook

Since IPython already has a backend that generates HTML output for images, you can use their inline backend: from matplotlib._pylab_helpers import Gcf from IPython.core.pylabtools import print_figure from base64 import b64encode # Plot something plot([1,2],[3,4]) # Get a handle for the plot that was just generated fig = Gcf.get_all_fig_managers()[-1].canvas.figure # Generate...

How do I change the kernel/python version for iPython?

python,osx,ipython

I just found the answer. In essence, this stems from not understanding the python installation layout and how resources are separated between installed interpreters. It appears each python version will have its own repository of tools, and the current "pip" command I had installed on the system was mapped for...

Explain {isinstance} in iPython prun output?

python,pandas,ipython

isinstance, len and getattr are just the built-in functions. There are a huge number of calls to the isinstance() function here; it is not that the call itself takes a lot of time, but the function was used 834472 times. Presumably it is the pandas code that uses it....

invalid syntax when run cProfile

python,ipython,profile,cprofile

As satoru suggested, you would normally run a command like this in your shell/terminal/console (for everyday usage, these basically mean the same thing). However, you can also run it from inside IPython, e.g.: %run -m cProfile simple_test_script.py (the % symbol is part of the command, IPython has a few special...

AutoComplete in ipython with pandas Seems to be broken

python,pandas,autocomplete,ipython

This isn't specific to pandas. IPython cannot know/guess the type of the object returned by running frame[SomeCoulmnname] without actually running it. Since it also cannot assume running it is safe/fast/etc, it doesn't run it. Since it doesn't know the type of the object, it can't suggest completions for it. Series.<TAB>...

IPython, Ploting a Polynomial

plot,ipython,sympy,polynomials

Welcome to SO! The subs() method is not meant to be used with numpy arrays. lambdify() does what you want. Try: import numpy as np import matplotlib.pyplot as plt import sympy as sy sy.init_printing() # nice formula rendering in IPython x = sy.symbols("x", real=True) # the sample polynomial: pp =...

Bi-variant interactive function plotting using IPython

python,ipython,ipython-notebook

Yes, this should be possible with interact For further reading there are a couple of example notebooks in the github repository that can be used as an introduction into interactive widgets. %matplotlib inline from IPython.html import widgets import numpy as np import matplotlib.pyplot as plt fun_map = { "sin": np.sin,...

Using iPython with nose?

python,ipython,nose,pdb

Most likely nose captures stdout. If you can run it with -s option it should work as expected. You can also use from nose.tools import set_trace; set_trace() to use pdb debugger, it will pass stdout/stdin properly.

IPython change input cell syntax highlighting logic for entire session

python,ipython,syntax-highlighting,ipython-notebook

To replace IPython.config.cell_magic_highlight, you can use something like import IPython js = "IPython.CodeCell.config_defaults.highlight_modes['magic_fortran'] = {'reg':[/^%%fortran/]};" IPython.core.display.display_javascript(js, raw=True) so cells which begin with %%fortran will be syntax-highlighted like FORTRAN. (However, they will still be evaluated as python if you do only this.)...

IPython3 automatically config %matplotlib inline

python,matplotlib,ipython,ipython-notebook

Use the option in ~/.ipython/profile_default/ipython_kernel_config.py

Default notebook directory in iPython Notebook - iPython 3.0.0

ipython,ipython-notebook

The config has changed for this; it's now FileContentsManager.root_dir.

How to inspect generators in the repl/ipython in Python3

python,python-3.x,ipython,python-3.4

Your idea of previewing or rewinding a generator is not possible in the general case. That's because generators can have side effects, which you'd either get earlier than expected (when you preview), or get multiple times (before and after rewinding). Consider the following generator, for example: def foo_gen(): print("start") yield...

install ipython for current python version 2.x

python,ipython

Use ipython2 to start a ipython2 shell, if you need to install for python2 use pip2 install ipython. pip obviously points to python3 on your system so specifying pip2 will install ipython for python2. Whatever the shebang points to will mean typing just ipython will start a shell for that...

Ipython notebook pyzmq error

ipython,ipython-notebook

Looks like you need the pyzmq package (version >= 13). You can try installing it (or upgrading if need be) with : pip install --upgrade pyzmq ...

Remember breakpoints when debugging using ipython

python,debugging,ipython

You can write an initialisation file for pdb which lists all the break points you want to add to the program. It must be called .pdbrc and placed either in the working directory or your home directory. Break points can be specified by either line number or by function name....

Pass variable to Ipython Widget

python,input,widget,ipython

Is this what you are trying to do? %matplotlib inline from IPython.html.widgets import interact, fixed import matplotlib.pyplot as plt import numpy as np def plf(x,lm,ls): plt.plot(x[lm:ls],np.sin(x)[lm:ls]) data = [1,2,3,4,5,6,7,8,9] max_lm = max(data)//2 max_ls = max(data) interact(plf,x=fixed(data),lm=(0,max_lm,1),ls=(max_lm, max_ls,1)) ...

jupyter kernels in OSX: No module named IPython

python,osx,ipython,anaconda,jupyter

Updating to IPython 3.2.0 will fix this issue. For details see pull request PR-8527.

ipython use “%run” to execute a subset of a file

python,ipython,magic-function

%run doesn't have an option for this. You can see all the options it takes by doing %run? inside IPython. However, you can bring a specific range of lines from a file into the interactive prompt, and run it from there. The syntax to do this looks like: %load -r...

IPython Notebook: %run magic on non-python file types

python,ipython

Creator of ipython suggests this: %%bash . ~/.bashrc ...

How to access a variable in IPython from a program executed by %run

python,ipython

You could first check for the variable's existence, and only assign to it if it doesn't exist. Example: if __name__=="__main__": if not "foo" in globals() foo = expensiveDataProcessClass(filepath) However, this won't actually work (in the sense of saving a foo assignment). If you read IPython's doc on the %run magic,...

TypeError: zip argument #1 must support iteration (Vector sum for Ipython)

python,vector,ipython,linear-algebra,ipython-notebook

If you do vector_sum(a) the local variable result will be the integer "1" in your first step which is not iterable. So I guess you simply should call your function vector_sum like vector_sum([a,b,a]) to sum up multiple vectors. Latter gives [4,7,10] on my machine. If you want to sum up...

Is it possible to “mute” cells in ipython?

python,ipython

Change the type of cell to Raw NBConvert. The code won't run, nor will it cause any output for that cell....

Read values from another cell in IPython Notebook and supply them for “input()”

python,ipython,ipython-notebook

I write this as an answer, although this is more or less a comment. One "hacky" way is to overwrite input or make a generator which returns an input-function with a constant return value. So kind of mocking it… def input_generator(return_value): def input(): return return_value return input This will work...

Print into console terminal not into cell output of IPython Notebook

python,windows,ipython,ipython-notebook,python-3.4

You have to redirect your output to the systems standard output device. This depends on your OS. On Mac that would be: import sys sys.stdout = open('/dev/stdout', 'w') Type the above code in an IPython cell and evaluate it. Afterwards all output will show up in terminal....

Add months to a datetime column in pandas

python,python-2.7,python-3.x,pandas,ipython

This is a vectorized way to do this, so should be quite performant. Note that it doesn't handle month crossings / endings (and doesn't deal well with DST changes. I believe that's why you get the times). In [32]: df['START_DATE'] + df['MONTHS'].values.astype("timedelta64[M]") Out[32]: 0 2035-03-20 20:24:00 1 2035-03-20 20:24:00 2...

IPython notebook 3.0 automatically close brackets

ipython,ipython-notebook

The bug fix is in progress and will be release probably in 3.1 see this issue

How do I configure mathjax for iPython notebooks?

python,ipython,ipython-notebook,mathjax

A simple test to make sure that you're getting the configuration correct is to change preferredFont: "TeX" to scale: 200. Then save and reload a notebook. The math should be obviously way bigger than before. So assuming that worked, it means your config.js is doing what it needs to. Now,...

IPython notebook stops evaluating cells after plt.show()

python,pandas,matplotlib,ipython,ipython-notebook

You should not use plt.show() in the notebook. This will open an external window that blocks the evaluation of your cell. Instead begin your notebooks with %matplotlib inline or the cool new %matplotlib notebook (the latter is only possible with matplotlib >= 1.4.3 and ipython >= 3.0) After the evaluation...

error in solving acoupled,first order differential equations in ipython

scipy,ipython

I think i have fixed it. a=0.05 b=0.02 c=0.03 d=0.04 def function(x,t): x1, x2, x3 = x[0], x[1], x[2] #x1, x2, x3 = A, B, J dx1=b*x2 dx2=-a*x1 dx3=c*x1-d*x2 return [dx1, dx2, dx3] x0 = [100,100, 1] t = linspace(0, 200, 200) x = odeint(function, x0, t) ...

No module named sympy

python,python-2.7,ipython,ipython-notebook,sympy

Given that you are new to Python I would advise that you install a distribution that already includes the complete scientific python stack such as WinPython or Anaconda. If it is specifically sympy you are after you can play around online at Sympy live. If you want to stick to...

Initialize interpreter with variables

python,ipython,interpreter,python-interactive

There are three options for the standard Python interpreter: python -i setup.py, as explained in tzaman's answer dropping into interactive mode from within setup.py, as explained in Jordan P's answer setting the environment variable PYTHONSTARTUP=setup.py. That last one is useful if you want to start and stop Python hundreds of...

Using both Python 2.x and Python 3.x in iPython Notebook

python,python-2.7,python-3.x,ipython,ipython-notebook

A solution is available that allows me to keep my MacPorts installation by configuring the Ipython kernelspec. Requirements: MacPorts is installed in the usual /opt directory python 2.7 is installed through macports python 3.4 is installed through macports Ipython is installed for python 2.7 Ipython is installed for python 3.4...

starting IPython using Python code

python,shell,ipython

This is from ipython starter script in linux. from IPython import start_ipython start_ipython() ...

double click to open an ipython notebook

python,ipython,ipython-notebook

You can use a project like nbopen that handle that and will open the browser on the right notebook + start an IPython server if one is not yet running.