ipython

Pandas plot x or index_column in descending order

霸气de小男生 提交于 2019-12-14 01:37:07
问题 I wanted to do some plots based on imported csv files from a chemical analysis. So I import as follows: In [91]: df = pd.read_csv('/file_location/Untitled 1.csv', delimiter = '\;', index_col = 'IR') df Out[91]: Sample 1 Sample 2 IR 300 1 0 400 5 4 500 6 0 600 0 8 4 rows × 2 columns In [98]: df.plot() Fine looks good. By convention this type of data i plotted with the x axis in descending order. Highest number to the right (do not ask me why). So i reorder the index-col: In [97]: df2 = df.sort

ipdb show color code instead of color

大城市里の小女人 提交于 2019-12-14 01:28:54
问题 Use import ipdb; ipdb.set_trace() to insert breakpoint. Color is fine when first hit the breakpoint, but it shows color code instead of true color when hit the BP the second time (by press c ) and so on. ←[1;32m 72 ←[1;33m ←[1;32mimport←[0m ←[0mipdb←[0m←[1;33m;←[0m ←[0mipdb←[0m←[1;33m.←[0m←[0mset_trace←[0m←[1;33m(←[0m←[1;33m)←[0m ←[1;31m# XXX BREAKPO INT←[0m←[1;33m←[0m←[0m It is in windows 7, python 2.7 and 2.6 have the same issue. I think one work around method is using nocolor scheme (how

IPython Notebook - python3 not found after uninstalling Anaconda3 for Anaconda

三世轮回 提交于 2019-12-13 18:59:27
问题 I uninstalled Anaconda 2.3 with Python 3.4.3 and then installed the same Anaconda version with Python 2.7.10. When I open a notebook via $ ipython notebook "Example Notebook.ipynb" it tries to use the python3 kernel as opposed to opening with the installed python2. Of course I get the error python3 kernel not found . How can I get ipython notebooks to open with the python2 kernel? I've tried to uninstall ipython and ipython notebook, then delete .ipython and .jupyter from my user directory in

How to install pygtk within virtualenv?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 16:22:30
问题 I installed ipython in a virtual env (1.13 with 2.7.2) and tried ipython -gui=gtk but still got the basic terminal interface with no %paste support for example. Now I tried installing pygtk but no success there either. I'm running Crunchbang linux with OpenBox WM. [TerminalIPythonApp] GUI event loop or pylab initialization failed --------------------------------------------------------------------------- ImportError Traceback (most recent call last) ...python2.7/local/lib/python2.7/site

Geojson in Ipython display cannot be imported in jupyter notebook

送分小仙女□ 提交于 2019-12-13 16:05:42
问题 I'd like to know why the copy-pasted example from the Iphython.display Geojson won't import in Jupyter notebook. from IPython.display import GeoJSON GeoJSON(data={ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-81.327, 296.038] } }, url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png", layer_options={ "basemap_id": "celestia_mars-shaded-16k_global", "attribution" : "Celestia/praesepe", "minZoom" : 0, "maxZoom" : 18, }) The

Pandas and NumPy default width change on startup

回眸只為那壹抹淺笑 提交于 2019-12-13 14:46:59
问题 Is there a way to specify Pandas and NumPy display width on startup of an IPython shell. For example, # Run this at startup import numpy as np np.set_printoptions(linewidth=200) import pandas as pd pd.options.display.width = 200 回答1: For Windows, for me, I have a startup directory: 'C:\Users\username\.ipython\profile_default\startup' In this I create a file: '00-script.py` Files in this directory will be run in alphabetical order by name. I put '00' in front to ensure it gets run first. In

How do I provide inline input to an IPython (notebook) shell command?

和自甴很熟 提交于 2019-12-13 14:01:39
问题 I want to put together an IPython notebook with some shell commands and their input. In the bash prompt I can use "here-document" syntax: bash-3.2$ mysql -u root <<END_IPUT > use mydb; > show tables; > END_INPUT How do I get the same effect in IPython, and specifically in a jupyter notebook? I know how to execute shell commands as IPython as "line magics" or "cell magics", e.g.: In [7]: !! ls -tF Out[7]: ['Demo-notebook.ipynb', 'createdb.sql', ... I've looked at IPython as a system shell,

QApplication instance causing python shell to be sluggish

ε祈祈猫儿з 提交于 2019-12-13 13:08:03
问题 My IPython shell becomes sluggish after I instantiate a QApplication object. For example, even from a fresh start, the following code will make my shell sluggish enough where I have to restart it. from PyQt4 import QtGui app = QtGui.QApplication([]) As soon as that is submitted, my typing becomes lagged by 2 or 3 seconds. My computer is not fantastic, but I still have plenty of available memory, and it's only the python shell that seems to be affected. I've tried both the default python

need to restart python while applying Celery config

我怕爱的太早我们不能终老 提交于 2019-12-13 07:03:13
问题 That's a small story... I had this error: AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for' When changed tasks.py, like Diederik said at Celery with RabbitMQ: AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for' app = Celery('tasks', backend='rpc://', broker='amqp://guest@localhost//') ran it >>> from tasks import add >>> result = add.delay(4,50) >>> result.ready() got DisabledBackend again ... hmm what was that.. put code to file run.py

Not getting back the column names after reading into an xlsx file

旧巷老猫 提交于 2019-12-13 07:02:28
问题 Hello I have xlsx files and merged them into one dataframe by using pandas. It worked but instead of getting back the column names that I had in the xlsx file I got numbers as columns instead and the column titles became a row: Like this: Output: 1 2 3 COLTITLE1 COLTITLE2 COLTITLE3 When they should be like this: Output: COLTITLE1 COLTITLE2 COLTITLE3 The column titles are not column titles but rather they have become a row. How can I get back the rightful column names that I had within the