Questions tagged [ipython]

1

votes
1

answer
145

Views

IPython.embed() does not use terminal colors

I will frequently use IPython.embed() to examine the state of running code. In earlier versions of IPython, it correctly determines color capability of my terminal (xterm), and uses colored text. In the latest version of IPython (7.2.0), only black and white text are shown when using IPython.embed...
Eldritch Cheese
1

votes
4

answer
598

Views

jupyter-notebook, ImportError: cannot import name 'Type'

I am a window user, and I have install python 3.6 on my computer. In order to use jupyter notebookd, I downloaded atom, i have ipython and pandas installed already. After my installation, I find after entering the command 'jupyter notebook' on the command-line , my browser will not open jupyter note...
1

votes
1

answer
2.7k

Views

How to create a histogram of 2D arrays in ipython

I have use the random number generator create a 1000*1000 2d arrays. How can i create a histogram of those 2D arrays? s1=np.random.rand(1000,1000)
Michael Ji
1

votes
1

answer
382

Views

IPython SQL Magic - Generate Query String Programmatically

I'm generating SQL programmatically so that, based on certain parameters, the query that needs to be executed could be different (i.e., tables used, unions, etc). How can I insert a string like this: 'select * from table', into a %%sql block? I know that using :variable inserts variable into the %%...
econgineer
1

votes
3

answer
133

Views

Difficult workflow writing Latex book full of Python code

I'm writing a book on coding in python using Latex. I plan on having a lot of text with python code interspersed throughout, along with its output. What's really giving me trouble is when I need to go back and edit my python code, it's a huge pain to get it back nicely into my latest document. I've...
Adam B
0

votes
0

answer
12

Views

“'OSError: [Errno 23] Too many open files in system:' When importing functions on all engines”

I am trying to process a list of objects in parallel on a cluster using ipyparallel but I am having an error saying too many files open. I am using Jupyter notebook and can start 230 engines on the cluster. I am using Jupyter notebook and can starte 230 engines on the cluster. When trying to impor...
BND
1

votes
0

answer
222

Views

How to interactively update IPywidgets container (VBox, HBox)?

When I try to update a container that contains other dynamically created container it doesn't change. I tried different options but in the current one I defined the variables holding the containers before the update function and call this function whenever a change occurs: history_array = [] fig_arr...
Patrick
1

votes
0

answer
83

Views

Draw plot on a supercomputer using ipython

I want to plot a figure using python on a supercomputer. For example, I wrote a script plot.py: import numpy as np import matplotlib.pyplot as plt .... .... plt.plot(m) # m is a matrix with size (1000,36) plt.show() If I do: python3 plot.py there is no picture. But I can get all other numerical...
Shuaishuai Yuan
1

votes
1

answer
53

Views

Different behavior between Jupyter kernel and Python

I've been working on a Jupyter notebook on my local, and have recently migrated it to an Ubuntu Linux VM located on a remote server. I've install Python and Jupyter on the remote server successfully, and am accessing it via SSH portforwarding. I have been able to run other scripts and files successf...
Mike
1

votes
0

answer
65

Views

Optimization: alternatives to passing large array to map in ipyparallel?

I originally wrote a nested for loop over a test 3D array in python. As I wanted to apply it to larger array which would take a lot more time, I decided to parallelise using ipyparallel by writing it as a function and using bview.map. This way I could take advantage of multiple cores/nodes on a supe...
mallowcodes
1

votes
0

answer
213

Views

Using python3 locally while running pyspark3 jupyter kernel

Does anyone know how to change the specific instance of python invoked in the %%local spark magic when running a pyspark3 kernel in jupyter? When running the PySpark3 kernel that ships with sparkmagic, I often want to pull data down to my local machine and do some calculations there. However, the...
John
1

votes
0

answer
178

Views

Import of package works in IPython shell but not in Jupyter notebook

I think this question is probably closely related to another one I had, but I'm not sure what the best general-purpose answer is. On my laptop, if I log into the IPython shell, I can execute In [1]: import matplotlib without error. But if I try to do the same thing in a Jupyter notebook, I get the f...
dbliss
1

votes
0

answer
51

Views

PyCharm: Configuring Run command to execute python script having jupyter magic commands

Currently in PyCharm, using the Run command (shift + F10) to execute a script with jupyter magic commands fails giving a syntax error. Is there a way of editing the Run Configuration to execute such scripts with an error? I use the ipython console and execute selection to console (Alt + Shift + E)...
hrishi
1

votes
0

answer
2.9k

Views

Python - How do I get my GUI to display in Spyder

I'm new to creating GUI's in Python and can't seem to get over the first hurdle. I'm using Anaconda - Spyder and I normally run all (mainly mathematical) code through this (and the IPython console?). My issue is that when I run the code below I'm expecting it to display a simple blank window but not...
Steven Goddard
1

votes
0

answer
967

Views

convert jupyter notebook saved as .HTML file back into .IPYNB

Can I convert a Jupyter Notebook saved as .HTML file back into .IPYNB file? The executable original notebooks were lost. The nbconvert docs don't have anything useful for this case. Currently I have to copy-paste bunch of cells into a new notebook, but this is very tedious and output cells will be...
denfromufa
1

votes
1

answer
143

Views

Integer is required (got type str): using ipyparallel and jupyter

I'm trying to get ipyparallel working. I'm following the Getting Stared guide but the basic functionality isn't working on my machine. I launch a cluster from the command line ipcluster start -n 4 and then I run the script: import ipyparallel as ipp c=ipp.Client() print(c[:].apply_sync(lambda : 'He...
Brian
1

votes
1

answer
125

Views

Set default value for interact in jupyter notebooks

I have a problem with a widget. It is a selection list that selects the range of months for a graph output. This means the value which is used to fill the following line. df4[(df4.year_month >= begin) &(df4.year_month
Fabian Kramer
1

votes
0

answer
175

Views

How to install scala kernel for hydrogen?

I'm looking at: https://nteract.io/kernels it's saying how to install python kernels for hydrogen: python -m pip install ipykernel python -m ipykernel install --user but which python -m pip install [scala kernel?] command should I use to install the scala kernel? or is it a whole other process? wher...
Jas
1

votes
0

answer
170

Views

Use ipython widgets to manipulate plots, that are constantly updated from within an infinite loop

Within an ipython notebook, using Jupyter I try to do a calculation, thats running for an extended period of time in a while loop. I use pyplot to show the current status of my calculation and I would like to be able to communicate with the calculation and the plot via ipywidgets. For example this c...
FMey
1

votes
0

answer
30

Views

python mysterious command //#::

Looking for a tag that I could parse either in Python and in some other langages without bugging anything, I found this strange thing (I code in Python here) ( line In [16] ): In [15]: print('standard python') In [16]: //#:: ...: ...: hello ...: print('hey') ...: exit() ...: ....
Gui3
1

votes
2

answer
80

Views

How to find min and max time in Chat log conversation using pandas for calculating duration?

Want to calculate the duration of each ID and to write in the separate Columns ID Ques Time Expected output ---------------------------------- 11 Hi 11.21 1min 11 Hello 11.22 13 hey 12.11 10mins 13 what 12.22 14 so 01.01 2mins 14 ok 01.03 ----------------------...
RVKNLP
1

votes
1

answer
194

Views

Spyder - IPython console - enable printing across the screen width

I am using the IPython console through Spyder. Is it possible to allow the console to print across the entire screen? The included picture shows the amount of empty space in the console. It's especially frustrating when I print a dataframe with many columns and I'm limited to seeing 6 at a time.
jstauss
9

votes
3

answer
14.7k

Views

How to show a bar and line graph on the same plot

I am unable to show a bar and line graph on the same plot. Example code: import pandas as pd import numpy as np import matplotlib.pyplot as plt Df = pd.DataFrame(data=np.random.randn(10,4), index=pd.DatetimeIndex(start='2005', freq='M', periods=10), columns=['A','B','C','D']) fig = plt.figure() ax =...
user2546580
1

votes
1

answer
247

Views

timing in python with %timeit %%timeit how to keep/retain values for later use

I am trying to measure the execution time of different parts of my code, a few lines each. I am doing this with %%timeit, however after I execute a cell, I find that the values calculated for variables in the cell are not kept in memory for next cells, as in the following example. Why does this ha...
Vincenzooo
1

votes
0

answer
192

Views

Use a single iPython console to run files and parts of code in PyCharm

I started using Pycharm and managed to have the python prompt running after a file is run (link) and I found how to run pieces of code in the current iPython console (link). For data science, however, it is very convenient to have a single iPython console/Python kernel where I can run files and code...
rpicatoste
1

votes
1

answer
403

Views

Run jupyter notebook in incognito window

On executing the command jupyter notebook, notebook opens on Mozilla Firefox. How to open notebook on incognito mode of Mozilla Firefox from command line?
hanugm
1

votes
0

answer
144

Views

ipyparallel Parallel for loop that appends to list

I have a loop which does a bunch of CPU intensive calculations and appends the result to a list, per iteration. How can I have that working in parallel. On C# there are concurrent containers, how does it work in ipyparallel? From the ipyparallel documentation: Python’s builtin map() functions allo...
Abel Dantas
1

votes
0

answer
22

Views

standalone instructions work but they don't work inside a function

I am sorry if my question is for newbie, but I think it's very very strange. I have the following piece of code: import apt_pkg import apt pkg='linux-image-4.4.0-116-generic' p=apt.progress.text.AcquireProgress() c=apt.Cache() u=c[pkg].candidate.uri a=apt_pkg.Acquire(p) apt_pkg.AcquireFile(a,uri=u)...
MysticDog
1

votes
0

answer
418

Views

Run script in a loop with different arguments in each repeat

I often find myself running a script in ipython with a range of parameter values: %run myscript.py --param 1 %run myscript.py --param 2 %run myscript.py --param 3 ... But then want to redo that whole lot after a small tweak to myscript.py. From the shell, I could, and often do, use a construct like...
Bonlenfum
1

votes
0

answer
64

Views

How do I unload an iPython extension that doesn't define how to unload itself?

I've loaded the autoreload iPython extension using: In [1]: %load_ext autoreload I want to unload it, but the following results: In [1]: %unload_ext autoreload The autoreload extension doesn't define how to unload it. So, who can help me out here?
mrclary
1

votes
1

answer
87

Views

code for value.counts() in columns pretaining to a specific value in one column

I'm new to data science and trying to do some data wrangling with python 2.7 in iPython notebook. A tutorial I was following for my first project asked me to replace all NaN intputs with 0 or 1. But I'd like to consider another approach where I can 1st look at the count for the rows with non-numeric...
uharsha33
1

votes
2

answer
174

Views

Code for imputing values in a specific column using the particular rows Index number or unique ID?

I'd like to input certain value in a particular column. my data looks something like: LoanID Married ApplicantIncome CoapplicantIncome Credit_History LP00135 NaN 33460 16000 1.0 LP00234 Yes 55000 70000 1.0 LP00432 No...
uharsha33
1

votes
1

answer
391

Views

Python doesn't see installed module when running ipython

so I'm getting really nervous about that. I created a fresh new conda environment and installed there geopandas with its modules: conda create -n geo2 -c conda-forge geopandas So, then I'm activating the environment: activate geo2 And then, just like I'd Taylor, I check it once, then I check it twi...
MikolajM
1

votes
1

answer
308

Views

Bus error (core dumped) with matplotlib pyplot

Using the IPython console to generate a matplotlib.pyplot chart I only recently get Bus error (core dumped). My OS is Ubuntu 16.04 LTS and I'm using Anaconda Python distribution. Python 2.7.14 |Anaconda custom (64-bit)| (default, Dec 7 2017, 17:05:42) IPython 5.4.1 -- An enhanced Interactive Pytho...
Justin Solms
1

votes
0

answer
63

Views

Keras model doesn't work with a larger dataset

I'm just getting started with Keras and with Deep learning, so the answer to my question could be obvious to some, but for me it isn't. I made a model to colorize some black and white photos following the article on Floydhub (where I'm training it) and it works just fine when I train it with similar...
Kenneth Caselli
1

votes
0

answer
118

Views

IPython crashes on tab completion

I've encountered an annoying issue causing ipython to crash on tab completion. Occurs frequently and persistently, yet without any clear indication what causes it. Has anyone else encountered this? If so, is there a workaround? I'm running IPython 6.2.1 on Python 3.6.4. Here's the error message just...
Vlas Sokolov
1

votes
0

answer
40

Views

flask user authentication - and cname setup of jupyter notebook via apache

This is the challenge. My domain hosts a simple page on www.mydomain.com for everyone to see, on admin.mydomain.com it serves a flask app with user authentication for partners/clients. My ipython jupyter notebook serves by default on startup on mydomain.com:8888, for which I created a CNAME record...
April
1

votes
0

answer
102

Views

removing the date from a PDF-Latex output through IPython Notebook conversion

How can I remove the date from a PDF-Latex output through IPython Notebook conversion? I have tried removing so many packages in the Latex document but the date doesn't seem to be removed
Yousra
1

votes
1

answer
244

Views

Enable and disable debugger in Ipython/Jupyter, skip breakpoints in disabled mode

I found that to activate a debugger in jupyter, I just need to use set_trace from IPython.core.debugger import set_trace def add_to_life_universe_everything(x): answer = 42 set_trace() answer += x return answer add_to_life_universe_everything(12) When I run the cell, I get an interactive debugger br...
Charan
1

votes
0

answer
62

Views

Command lines in Jupyter Notebook conversion for production

I've been using Jupyter Notebooks for my data analysis and loved it. Now I'm in the process of cleaning up the scripts and documenting everything. The analysis is a 'once-through' with static input and static output so no continuous running scripts. I've been using nbconvert to create .py scripts ba...
Rutger Hofste

View additional questions