spyder

Study Python with Spder

做~自己de王妃 提交于 2019-11-30 12:21:33
Study Python with Spyder http://datasciencesource.com/python-with-spyder-tutorial/ Python With Spyder 3: Functions and Scoping variable|arguments pass in x=10 def myfun1(x): y=x**2 x=27 return y print('f=',myfun1(5)) f= 25 print ('x=',x) x= 10 z=10 def myfun2(x): global z y=x**2+z z=27 return y print('f=',myfun2(5)) f= 35 print ('z=',z) z= 27 global variable z=10 def myfun2(x): global z y=x**2+z z=27 return y print('f=',myfun2(5)) f= 35 print ('z=',z) z= 27 multiple arguments x=1 y=2 z=3 def myfun3(x,y,z): out=x 2+y 2+z**2 return out print('f=',myfun3(x,y,z)) f= 14 optional arguments x=1 y=2 z

Changing indentation settings in the Spyder editor for Python

别说谁变了你拦得住时间么 提交于 2019-11-30 11:51:41
I am using the Spyder editor for Python. I need to change the indentation setting (e.g., let "tab" mean "4 spaces"). How do I accomplish this? Tools >>> Preferences >>> Editor >>> Advanced settings >>> Indentation characters go to >>>Tools in the menu bar Preferences >>> Editor >>> Advanced settings >>> Indentation characters set indentation characters: to "4 spaces" hurray! Mission accomplished 来源: https://stackoverflow.com/questions/36187784/changing-indentation-settings-in-the-spyder-editor-for-python

ImportError: No module named enum

六眼飞鱼酱① 提交于 2019-11-30 11:15:46
问题 I changed from Win XP 32bit to Win7 64bit and reinstalled Python 2.7 and the Anaconda package. However, it seems like it isn't properly installed. When I do import enum There is the error: ImportError: No module named enum However, when I try import pandas it works. When typing help() and modules within Ipython nothing happens. Any idea how to go from here? 回答1: Or run a pip install --upgrade pip enum34 回答2: I ran into this same issue trying to install the dbf package in Python 2.7. The

How to change the Spyder editor background to dark?

こ雲淡風輕ζ 提交于 2019-11-30 11:11:10
问题 I've just updated Spyder to version 3.1 and I'm having trouble changing the colour scheme to dark. I've been able to change the Python and iPython console's to dark but the option to change the editor to dark is not where I would expect it to be. Could anybody tell me how to change the colour scheme of the Spyder 3.1 editor to dark? 回答1: Please go to Tools > Preferences > Syntax Coloring and select there the dark theme you want to use. 回答2: Tools->Preferences->Syntax coloring->Scheme changed

%matplotlib line magic causes SyntaxError in Python script

。_饼干妹妹 提交于 2019-11-30 10:21:48
问题 I try to run the following codes on Spyder (Python 2.7.11): # -*- coding: utf-8 -*- import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt import matplotlib.cm as cm import tensorflow as tf # settings LEARNING_RATE = 1e-4 # set to 20000 on local environment to get 0.99 accuracy TRAINING_ITERATIONS = 2000 DROPOUT = 0.5 BATCH_SIZE = 50 # set to 0 to train on all available data VALIDATION_SIZE = 2000 # image number to output IMAGE_TO_DISPLAY = 10 But I got this

How to get Spyder to open python scripts (.py files) directly from Windows Explorer

半城伤御伤魂 提交于 2019-11-30 08:31:13
I have recently installed the Anaconda distribution on Windows 7 (Anaconda 3-2.4.0-Windows-x86_64). Unlike IDLE, I can't right-click and open a py file in the Spyder IDE. I will have to open Spyder first and then navigate to the file or drag and drop it in the editor. Is there any way to open the file in the editor directly from Widows Explorer? With the current version of Anaconda (4.1.0) you can simply right-click on a python script in Windows File Explorer and choose "Open with". The first time you do this you need to select "Choose default program" and then browse to spyder.exe in the

spyder - clear variable explorer along with variables from memory

白昼怎懂夜的黑 提交于 2019-11-30 07:19:00
To clear the console we can use the following command - import subprocess as sp tmp = sp.call('cls',shell=True) However, to remove a variable from memory, we often rely upon - using del command removing variable manually by using the drop-down menu in variable explorer But both of them are variable specific and hence time-consuming. So is there any general command (like clear under MATLAB) to remove a variable from memory and thereafter from Spyder's Variable Explorer. In Spyder, Do following steps Run Configuration per file... Clear all variables before execution [Select Checkbox] This

Why autocompletion options in Spyder 3.1 are not fully working in the Editor?

霸气de小男生 提交于 2019-11-30 07:13:26
问题 Running on Mac Sierra, the autocompletion in Spyder (from Anaconda distribution), seems quite erratic. When used from the Ipython console, works as expected. However, when used from the editor (which is my main way of writing), is erratic. The autocompletion works (i.e. when pressing TAB a little box appears showing options) for some modules, such as pandas or matplotlib. So writing 'pd.' and hitting TAB, gets the box with options as expected. However, this does not happen with many other

Interactive(?) plotting in Spyder with matplotlib

南楼画角 提交于 2019-11-30 07:12:22
问题 I am trying to migrate over to Python from Matlab and can't figure out how to get interactive(?) plotting working within the Spyder IDE. My test code is shown below. With the .ion() nothing happens, I get a quick flash of a figure being drawn then the window instantly closes and spits out my Hello. Without the .ion() the figure is drawn correctly but the script hangs and doesn't spit out Hello until I manually close the figure window. I would like the script to run like a matlab script would

Importing arcpy module into anaconda's Spyder

跟風遠走 提交于 2019-11-30 05:26:14
问题 I would like to use arcpy into Anaconda's Spyder. I have a full ArcGIS license, so this is not an issue. I am able to semi-import the module by way of copying the the arcpy folder out of C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy and into C:\Anaconda\Lib\site-packages, but the import is never completed because I get an error of "ImportError: No module named arcgisscripting". Is there any way for arcpy to work in Spyder? 回答1: This is what you need to do: Open the Python window in ArcGIS,