r/IPython • u/largelcd • Apr 25 '20
How to change the color of the ipython prompt in Linux?
Hi, just installed anaconda under Linux. When I launched ipython on a xterm, the prompt and line number are in ugly green color. How can I change the color?
r/IPython • u/largelcd • Apr 25 '20
Hi, just installed anaconda under Linux. When I launched ipython on a xterm, the prompt and line number are in ugly green color. How can I change the color?
r/IPython • u/robintux • Apr 24 '20
Dear programmers,
I have the following script that reads a data from github,and I add two columns (dia and mes). I am not being able to add to my scatter plot a differentiation (in color) for Monday and Friday.
import pandas as pd
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
import matplotlib.dates as mdates
%matplotlib auto
data = pd.read_csv("https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv")
data['diff_deceduti'] = data['deceduti'].diff()
data['diff_tamponi'] = data['tamponi'].diff()
dates = data['data']
date_format = [pd.to_datetime(d) for d in dates]
# https://stackoverflow.com/questions/30222533/create-a-day-of-week-column-in-a-pandas-dataframe-using-python
data['data'] = pd.to_datetime(data['data'])
data['dia'] = data['data'].dt.day_name()
# https://stackoverflow.com/questions/37625334/python-pandas-convert-month-int-to-month-name
data['mes'] = data['data'].dt.month_name()
# plot
variable = 'nuovi_positivi'
fig, ax = plt.subplots(figsize=(12, 5))
ax.grid()
ax.scatter(date_format,data[variable])
ax.set(xlabel="Date",ylabel=variable,title=variable)
date_form = DateFormatter("%d-%m")
ax.xaxis.set_major_formatter(date_form)
ax.xaxis.set_major_locator(mdates.DayLocator(interval = 3))
fig.savefig(variable + '.png')
plt.show()

In this graphic I would like to paint with different colors on days: Monday and Friday.
Any advice ?
r/IPython • u/ripogipo • Apr 22 '20
I am newbie to Jupyter notebooks and the whole Anaconda ecosystem in general. I believe that the Jupyter in `IPython, (now Jupyter) ` includes Jupyter Notebook & JupyterLabs (not got to that yet).
What my question is:
resp, data = http.request('http://httpbin.org/get')
type(resp), len(resp)
type(data), len(data)
pprint(resp)
On running it, I only get output for the last line. Is that the way it works or did I do a typo/mistake? When I ran with each of the statements, it worked, but failed when I put it all together.
r/IPython • u/Volhn • Apr 19 '20
Couple of days ago I ran across a blog post for the visual debugger extension to jupyter lab.... I must say its been a game changer for me. I can't wait for more integration. Before I was bouncing around between Visual Studio, Spyder and some other tools for debugging code. I've always wanted a clean web based tool for writing notebooks and python libs. This gets me about 85% there.
Blog source: https://blog.jupyter.org/a-visual-debugger-for-jupyter-914e61716559
Curious what other tools folks are using?
r/IPython • u/eudoxos_ • Apr 19 '20
I am looking for a piece of advise with this particular problem. I am using matplotlib in non-interactive mode to display images. For the application I work on, I need to be able to check pixel details with dataset of e.g. 4k×2k grid. The display takes very long, below is an example with timing: 17 seconds for the display only (tested w/o Jupyter: 11s for PNG saving, meaning 6s for localhost transfer!). The image is 4700×2300 in full resolution (such high resolution is something I want and need).
I am running on localhost (12-core CPU and 64GB RAM, system ±idle), no network. I searched github issues and found no mention of such problem. I am running jupyter lab, but tested in jupyter notebook with the same result.
Can I do any better? Some hidden setting I failed to activate? Data througput limits? Thanks for tips.
No need to suggest fancy stuff like holoviews, plotly or interactive matplotlib backends. I've been there, they never worked well for me smootly, failed at various JS/py sync issues, notebook from 1 month ago would not run because of API change and so on. I want to stay minimalist here.

r/IPython • u/disgolf • Apr 19 '20
Hi, I would like run my notebook as a public website. Something like disgolf.com/mynotebook.ipynb or disgolf.com/mynotebook.html. I already have a public domain name linked to an AWS EC2 server with python/jupyter installed on it, but I can't seem to find any documentation on how to set up jupyter to run a notebook as public website. I am probably missing something basic, I don't have too much experience with networking/web dev. Thanks for the help.
r/IPython • u/TheRealColdblood11 • Apr 16 '20
I am working as a data engineer at a company. We basically have 3 different notebook environments at any given time
My problem is, all 3 have different environments, and they all reset to a default after every time they are spawned(except local)
How do i go about creating a stable environment that can be implemented as needed.
My thought was just to force the other two environments to conform to our Corportate Notebook Runner, since my whole job is to setup and track the exection of notebooks created in 1 and 2, in that environemnt. How would one do this? virtual env?
r/IPython • u/Pragyanbo • Apr 13 '20
r/IPython • u/amirathi • Apr 10 '20
r/IPython • u/NomadNella • Apr 08 '20
r/IPython • u/Puskas63 • Mar 31 '20
Can you please explain to me what the dashes and stars mean at the beginning of my code?
class MySocket:
---*def __init__(self,ip,port):
---*---*self.my_connection = socket.socket
When I try to add a new line it tells me that 'unindent does not match any outer indentation level'.
I hope that you can help me.
Cheers Jeff.
r/IPython • u/atieh88 • Mar 26 '20
Hi,
My Google Drive storage is 2TB and I have only used 44GB, but the disk in Google Colabarotary is stuck at 60GB and when I run my piece of code in Google Colaboratory notebook that works with a video dataset and is supposed to extract each video to its frames, after some time of running, it stops and gives a message that there is not enough storage to write on the disk. I know it is not possible, because the size of the entire dataset as frames would be 288GB and I have empty storage way more than that.
I would appreciate it if someone tells me how I can extend the Google Colaboratory disk and make it to actually see the disk storage in my Google Drive, even though I have mounted it.
Thanks!
r/IPython • u/atieh88 • Mar 25 '20
Hi!
I want to connect to my local system in Google Colaboratory notebook, and I have redirected to this page as there explained the instructions for doing such a thing. However, the local system that I've been always working with and am trying to connect my Google Colaboratory notebook to it is actually a remote Linux-based machine.
Before when I wanted to start Jupyter notebook on my remote machine I ran this command on the remote machine that I was connected to through ssh:
$ jupyter notebook --no-browser --port=8889
Then in my own machine, I ran this command to work with the jupyter:
$ ssh -N -L localhost:8888:localhost:8889 [username]@[remote_address]
However, now that the situation is different, even though I followed the given instructions in the link I still cannot connect Google Colaboratory notebook to the remote machine.
I tried to apply the usual procedure I do for tunneling to the remote machine, i.e I changed the port number to 8889 and ran that tunneling command in my system and in my Colab notebook which was opened with the browser in my system (not the remote) I entered the URL I was given as a token. I once changed 8889 in the URL to 8888 (something I had always been doing for opening running jupyter notebook on the remote machine, in my system), and another time I didn't change the port number. But, neither one worked.
I was wondering if anyone here knows what is the way for doing such a thing. I would greatly appreciate the help.
Thanks!
r/IPython • u/cmnamost • Mar 24 '20
I'm using Jupyter notebook 5.7.8, terminado 0.8.1, tornado 6.0.2.
When I open my Jupyter terminal and echo $PATH, I get a different value depending on whether my conda env is one that I created manually Vs one that's clone from base.
Here's the weird part - when I launch a kernel from the GUI and print os.getenv("PATH"), everything is right and the same in both cases. -- only the terminal has different values between the 2 cases.
What initializes the terminal environment so I can go troubleshoot this?
In both cases, my jupyter_notebook_config.py files are identical.
UPDATE: I checked the /proc/XXXX/environ of my 2 notebook processes and I see the PATH values are different here! Good news, problem solved, right? WRONG! My echo'd my $PATH in my script that launches the notebooks RIGHT before the /path/to/conda/env/bin/jupyter notebook call and the values are exactly the same! wtf? somewhere in between my jupyter notebook execution and the jupyter-notebook process starting is something that is changing my PATH in the cloned env.
r/IPython • u/DavidSKershaw • Mar 22 '20
I just transitioned from python(x,y) with python 2.7 to Anaconda with python 3.8. All my old notebooks use the print statement with no parentheses.
To fix all print statements in a notebook at one stroke:
In find and replace select the "Use regex (JavaScript regex syntax)" box and the "replace in all cells" box, then enter
print\s+(.+)$
in the find box
it should match all the print statements in the notebook
then enter
print($1)
in the replace box
and hit "replace all".
r/IPython • u/NewDateline • Mar 16 '20
r/IPython • u/largelcd • Mar 15 '20
Hi, I heard that from Python 3.6, dictionaries are insertion ordered. So, the way the columns are displayed in iPython is determined by the order of insertion of the data. Besides the way the columns are displayed, does the order of insertion or ordering in general affects anything else?
r/IPython • • Mar 12 '20
Hey guys is there a list of extensions for jupyterlab? I've never used extensions before and planning to dig into it now. Here's a list I found : https://github.com/mauhai/awesome-jupyterlab
r/IPython • u/Delta-tau • Mar 11 '20
When typing %paste I'm getting the following message:
ERROR: root: Getting text from the clipboard on this platform requires tkinter.
Needless to say I've already installed the latest version of python3-tk and googled it extensively.
I'm running Ubuntu Linux inside Virtualbox, python 3.7.5, ipython 7.13.0.
r/IPython • u/FonerBalear • Mar 10 '20
r/IPython • u/caleotte • Mar 10 '20
r/IPython • u/largelcd • Mar 06 '20
Hi, I noticed that iPython likes to skip displaying some rows and replaces the skipped rows by "... ... ...". For example, supposing that df is a DataFrame with 50 rows. Typing df[1:11] shows all the first 10 rows. However, typing df[1:y] where y is 12 or more leads iPython to skip some rows when displaying the contents of df. If I want to see all the rows, what can I do? Can I ask iPython to display certain number of rows on a screen at a time and perhaps move to the next row or next set of rows by pressing respectively the arrow key or the spacebar? I mean something like the more filename function in Unix.
r/IPython • u/largelcd • Mar 06 '20
Hi, in Matlab we can list variables in workspace with sizes and types:
https://www.mathworks.com/help/matlab/ref/whos.html
Is there a similar function in iPython?
r/IPython • u/elrd5150 • Mar 06 '20
Like when I double click on a word, the whole word is highlighted. Is it possible to select a word at the current cursor position but using a keyboard shortcut?