jupyter-notebook

using multiple depended widgets from Jupyter notebook and @interactive, Problem if Dropdown Menu has only one option

假装没事ソ 提交于 2020-06-17 15:49:31
问题 Hey so my code refers to this here : Multiple dependent widgets (dropdown menu) on Jupyter notebook from ipywidgets import interact, Dropdown enfrom ipywidgets import interact, Dropdown geo = {'USA':['CHI','NYC'],'Russia':['MOW','LED']} geo2={'CHI':['1','2'],'NYC':['3','4'],'MOW':['5','6'],'LED':['7','8']} countryW = Dropdown(options = geo.keys()) cityW = Dropdown(options = geo[countryW.value]) # options = geo[countryW.value] is to remove inital error but not that necessary. districtW =

ipython autoreload kills state

泪湿孤枕 提交于 2020-06-17 13:20:27
问题 As recommended in (Reloading submodules in IPython) I added %load_ext autoreload %autoreload 2 to my notebook and now, indeed, the modules are automatically reloaded. Alas, I have try: # https://docs.python.org/library/importlib.html rala_all # reload will not reset rala_all except NameError: rala_all = {} in my module. It did work before using importlib, but, with autoreload I see rala_all being reset (to an empty dictionary) every time the module is reloaded. Is there a way to avoid this? I

Running Tkinter with interactive ipython notebook

时间秒杀一切 提交于 2020-06-17 10:46:01
问题 I want to create an interactive python coding game, where users can enter commands into a jupyter notebook and see the result on a GUI in real time. This seems to work fine in the regular python interactive shell. The way I get this to run is the following: I make a file, lets call it example.py with the following code: import tkinter as tk def create_canvas(): root = tk.Tk() root.resizable(False, False) root.title("Karel") frame = tk.Frame(root) frame.pack() canvas = tk.Canvas(frame, bg=

Running Tkinter with interactive ipython notebook

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-17 10:45:12
问题 I want to create an interactive python coding game, where users can enter commands into a jupyter notebook and see the result on a GUI in real time. This seems to work fine in the regular python interactive shell. The way I get this to run is the following: I make a file, lets call it example.py with the following code: import tkinter as tk def create_canvas(): root = tk.Tk() root.resizable(False, False) root.title("Karel") frame = tk.Frame(root) frame.pack() canvas = tk.Canvas(frame, bg=

Download a csv from url and make it a dataframe python pandas

本秂侑毒 提交于 2020-06-16 17:31:31
问题 I am new to python so need a little help here. I have a dataframe with a url column with a link that allows me to download a CSV for each link. My aim is to create a loop/ whatever works so that I can run one command that will allow me to download,read the csv and create a dataframe for each of the rows. Any help would be appreciated. I have attached part of the dataframe below. If the link doesn't work (it probably won't you can just replace it with a link from 'https://finance.yahoo.com

How do I configure Python and organise my interpreters?

岁酱吖の 提交于 2020-06-13 09:32:11
问题 Background: I have been learning Python (on MacOS) for about three months now, so please go easy on me. I began by installing Python 3.7 through Anaconda and predominantly used Jupyter Notebook to write code. As I learnt more, I found out about different text editors and IDEs, and tried out different programs: IDLE, Sublime and PyCharm. As I progressed I also learned about package management systems, such as pip and conda, and other such wonderful things that helped me achieve the things I

Anaconda Navigator Jupyter and Spyder won't start after successful installation

被刻印的时光 ゝ 提交于 2020-06-12 16:43:03
问题 I have installed Anaconda 3 on Windows 10 64-bit. The installation completed successfully. I could start idle.exe and it works. I can start the Anaconda Powershell and Anaconda Prompt, but I cannot start the Navigator nor Spyer or Jupyter. Launching them from the start menu will bring up the Windows shell windows for a moment, before they disappear and nothing happens. I have tried starting the navigator from the Anaconda Prompt and this is what the error message looks like: (base) PS C:

Anaconda Navigator Jupyter and Spyder won't start after successful installation

烈酒焚心 提交于 2020-06-12 16:35:50
问题 I have installed Anaconda 3 on Windows 10 64-bit. The installation completed successfully. I could start idle.exe and it works. I can start the Anaconda Powershell and Anaconda Prompt, but I cannot start the Navigator nor Spyer or Jupyter. Launching them from the start menu will bring up the Windows shell windows for a moment, before they disappear and nothing happens. I have tried starting the navigator from the Anaconda Prompt and this is what the error message looks like: (base) PS C:

Matplotlib AttributeError: module 'matplotlib.cbook' has no attribute '_define_aliases'

…衆ロ難τιáo~ 提交于 2020-06-11 17:20:10
问题 When trying to plot a graph on jupyter with pyplot I am running the following code: import matplotlib.pyplot as plt plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show() This is returning the following error: AttributeError Traceback (most recent call last) <ipython-input-16-51b004b519a9> in <module>() ----> 1 get_ipython().run_line_magic('matplotlib', 'inline') 2 3 4 import matplotlib.pyplot as plt 5 plt.plot([1,2,3,4]) c:\program files (x86)\microsoft visual studio\shared\python36_64

Multiple dependent widgets (dropdown menu) on Jupyter notebook

吃可爱长大的小学妹 提交于 2020-06-11 07:47:45
问题 I was following the example on how to handle multiple dependent widgets on jupyter notebooks from here: Dynamically changing dropdowns in IPython notebook widgets and Spyre In that example the code solution was the following: from IPython.html import widgets from IPython.display import display geo={'USA':['CHI','NYC'],'Russia':['MOW','LED']} def print_city(city): print city def select_city(country): cityW.options = geo[country] scW = widgets.Dropdown(options=geo.keys()) init = scW.value cityW