ipython

pandas dataframe as latex or html table nbconvert

淺唱寂寞╮ 提交于 2019-12-18 11:44:25
问题 Is it possible to get a nicely formatted table from a pandas dataframe in ipython notebook when using nbconvert to latex & PDF? The default seems to be just a left-aligned block of numbers in a shoddy looking font. I would like to have something more like the html display of dataframes in the notebook, or a latex table. Saving and displaying a .png image of an HTML rendered dataframe would also be fine, but how exactly to do that has proved elusive. Minimally, I would just like a simple

IPython console can't locate “backports.shutil_get_terminal_size” and won't load

杀马特。学长 韩版系。学妹 提交于 2019-12-18 10:36:01
问题 I'm running Python2.7 on windows 10 doing env and most pkg management with Anaconda. After upgrading a number of packages, my ipython console now fails to start in any IDE or at the console. When I attempt to run it at the console I get this error: Traceback (most recent call last): File "C:\Anaconda3\Scripts\ipython-script.py", line 3, in <module> import IPython File "C:\Anaconda3\lib\site-packages\IPython\__init__.py", line 48, in <module> from .core.application import Application File "C:

list memory usage in ipython and jupyter

那年仲夏 提交于 2019-12-18 10:23:29
问题 I have a few (almost ten) Gb of memory taken by the ipython kernel. I think this is coming from large objects (matrices, lists, numpy arrays, ...) that I might have produced during some operation and now I do not need anymore. I would like to list all of the objects I have defined and sort them by their memory footprint. Is there a simple way to do that? For certain types there is nbytes method, but not for all ... so I am looking for a general way to list all objects I have made and their

Make more than one chart in same IPython Notebook cell

萝らか妹 提交于 2019-12-18 10:19:31
问题 I have started my IPython Notebook with ipython notebook --pylab inline This is my code in one cell df['korisnika'].plot() df['osiguranika'].plot() This is working fine, it will draw two lines, but on the same chart. I would like to draw each line on a separate chart. And it would be great if the charts would be next to each other, not one after the other. I know that I can put the second line in the next cell, and then I would get two charts. But I would like the charts close to each other,

Make more than one chart in same IPython Notebook cell

邮差的信 提交于 2019-12-18 10:19:12
问题 I have started my IPython Notebook with ipython notebook --pylab inline This is my code in one cell df['korisnika'].plot() df['osiguranika'].plot() This is working fine, it will draw two lines, but on the same chart. I would like to draw each line on a separate chart. And it would be great if the charts would be next to each other, not one after the other. I know that I can put the second line in the next cell, and then I would get two charts. But I would like the charts close to each other,

collapse cell in jupyter notebook

浪子不回头ぞ 提交于 2019-12-18 09:59:48
问题 I am using ipython Jupyter notebook. Let's say I defined a function that occupies a lot of space on my screen. Is there a way to collapse the cell? I want the function to remain executed and callable, yet I want to hide / collapse the cell in order to better visualize the notebook. How can I do this? 回答1: The jupyter contrib nbextensions Python package contains a code-folding extension that can be enabled within the notebook. Follow the link (Github) for documentation. To install using

in Ipython notebook / Jupyter, Pandas is not displaying the graph I try to plot

懵懂的女人 提交于 2019-12-18 09:57:29
问题 I am trying to plot some data using pandas in Ipython Notebook, and while it gives me the object, it doesn't actually plot the graph itself. So it looks like this: In [7]: pledge.Amount.plot() Out[7]: <matplotlib.axes.AxesSubplot at 0x9397c6c> The graph should follow after that, but it simply doesn't appear. I have imported matplotlib, so that's not the problem. Is there any other module I need to import? 回答1: Note that --pylab is deprecated and has been removed from newer builds of IPython,

merge two dataframes without repeats pandas

蹲街弑〆低调 提交于 2019-12-18 09:29:41
问题 I am trying to merge two dataframes, one with columns: customerId, full name, and emails and the other dataframe with columns: customerId, amount, and date. I want to have the first dataframe be the main dataframe and the other dataframe information be included but only if the customerIds match up; I tried doing: merge = pd.merge(df, df2, on='customerId', how='left') but the dataframe that is produced contains a lot of repeats and looks wrong: customerId full name emails amount date 0

iPython: DLL load failed: The specified module could not be found; plain Python fine

回眸只為那壹抹淺笑 提交于 2019-12-18 09:05:46
问题 I keep getting this (well known) error in iPython. Yet, the same import works fine in plain Python. (Python 3.3.5, see details below) iPython: Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 2.0.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use

How can I prevent Python from inserting a new line after taking user input?

跟風遠走 提交于 2019-12-18 08:49:32
问题 Python inserts a blank line in the console output between every call of the input() function but I don't want that (i.e. I want the input() prompts to be on contiguous lines in the console instead of separated by a blank line). Is there a way to do that? I tried using input("foo", end="") thinking it may work like the print() function but that's not the case... Code: fname = input("Please enter your first name: ") lname = input("Please enter your last name: ") print("Pleased to meet you, " +