Re: When I need classes?

2016-01-13 Thread Mike S via Python-list

On 1/11/2016 3:45 PM, Travis Griggs wrote:



On Jan 10, 2016, at 9:48 AM, Bernardo Sulzbach  
wrote:

Essentially, classes (as modules) are used mainly for organizational purposes.

Although you can solve any problem you would solve using classes
without classes, solutions to some big problems may be cheaper and
more feasible using classes.


As a long term OO purist practitioner, I would add to this. Obviously, you can 
organize your code any way you want, with or without classes. You could put all 
your functions with an odd number of letters in one class, and all of the even 
numbered ones in another class.

Having listened to the guy (Alan Kay) who coined the term (Object Oriented 
Programming) quite a bit over the years, I believe that the focus of OO (of 
which classes are a particular implementation approach) is to bind behavior to 
data. In “traditional” programming approaches, one focused on the algorithm 
(behavior) first, and then figured out what data needed to flow where to get 
the job done. Classes provided a mechanism to turn that equation, generally 
speaking, around. One thinks about the data first, and then figures out what 
behavior binds best to that data. And how that data will interact (inter-object 
behavior, often called messages) to get your job done. For some (many) 
problems, this can be a real win. And for some, not so much.

I think, this is often why, for a simple script, OO just kind of gets in the 
way. You have a straightforward procedure that you just want to do. The state 
(data) is not rich enough to make making it the focal point of your program.


Well said, thanks!


--
https://mail.python.org/mailman/listinfo/python-list


Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-29 Thread Mike S via Python-list

On 1/28/2016 11:57 PM, Steven D'Aprano wrote:

On Fri, 29 Jan 2016 06:04 pm, Mike S wrote:


%matplotlib inline

I get an error on the last line. I am running this code in Idle Python
3.4.4 Shell...

Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32
bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
  >>> import numpy as np
  >>> import pandas as pd
  >>> import random
  >>> import matplotlib.pyplot as plt
  >>> %matplotlib inline
SyntaxError: invalid syntax

What am I doing wrong? Suggested reading?


That %matplotlib looks to me like iPython "magic" -- yes, that's the
official name for it. It's not real Python code, and won't run in a regular
Python interpreter like IDLE.

IPython is a custom Python interactive interpreter. As well as running
regular Python code, it includes special syntax for magic such as:

%cd
%run
%bg

and many more.

http://ipython.org/ipython-doc/rel-0.10.2/html/interactive/reference.html#magic

You could try installing iPython and running the tutorial examples in that,
or perhaps finding a better tutorial that actually bothers to mention what
it needs to run.

(You have read the tutorial from the beginning, yes?)


Thank you Chris and Steven, I'll see if I can get iPython running and do 
a tutorial.


--
https://mail.python.org/mailman/listinfo/python-list


>>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-29 Thread Mike S via Python-list
I have installed Python 3.4.4 on XPSP3 and am trying to work my way 
through this tutorial.


A Complete Tutorial on Ridge and Lasso Regression in Python
http://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-ridge-lasso-regression-python/

In Step 2 "Why Penalize the Magnitude of Coefficients?" we are shown 
this code:


#Importing libraries. The same will be used throughout the article.
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
%matplotlib inline

I get an error on the last line. I am running this code in Idle Python 
3.4.4 Shell...


Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 
bit (Intel)] on win32

Type "copyright", "credits" or "license()" for more information.
>>> import numpy as np
>>> import pandas as pd
>>> import random
>>> import matplotlib.pyplot as plt
>>> %matplotlib inline
SyntaxError: invalid syntax

What am I doing wrong? Suggested reading?
TIA,
Mike
--
https://mail.python.org/mailman/listinfo/python-list


Re: Install Error

2016-02-08 Thread Mike S via Python-list

On 2/3/2016 1:55 PM, Barrie Taylor wrote:

Hi,

I am attempting to install and run Python3.5.1 on my Windows machine.

After installation on launching I am presented the attached error message.
It reads:
'The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing 
from your computer. Try reinstalling the program to fix this problem.'
Needless to say, I have tried uninstalling and reinstalling ad repairing the 
program a number of times to no avail.

Any help with this issue would be greatly appreciated.

Kind Regards,

Barrie Taylor


What OS? On my XP machine I got 3.4.4. to work, although I couldn't 
figure out how to get IPython notebook to work, so I'm focusing on 
getting that to work on my w7 and w10 boxes. Idk if you need Ipython.


--
https://mail.python.org/mailman/listinfo/python-list


Re: setup failed

2016-02-08 Thread Mike S via Python-list

On 2/4/2016 4:39 AM, Prince Thomas wrote:

Hi
I am an computer science engineer. I downloaded the python version 3.5.1.amd64 
and just python 3.5.1.
The problem is when I install the program setup is failed and showing  
0*80070570-The file or directory is
corrupted and unreadable. I install the newest visual c++ redist and still 
same. My os is win 8.1.
Please help me out of this


This sounds similar. Did you install the 32 bit or 64 bit version? If 
you installed the 32 bit version and don't object to using the 64bit 
version I would try installing that.

https://mail.python.org/pipermail/python-list/2015-September/697456.html

--
https://mail.python.org/mailman/listinfo/python-list


from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.

2016-02-08 Thread Mike S via Python-list
I have Python 3.4.4 installed on Windows 7, also IPython, scipy, numpy, 
statsmodels, and a lot of other modules, and am working through this 
tutorial

http://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/

In Ipython notebook I run this code

from statsmodels.tsa.stattools import adfuller
def test_stationarity(timeseries):
#determining rolling statistics
rolmean = pd.rolling_mean(timeseries, window=12)
rolstd  = pd.rolling_std(timeseries, window=12)
#plot rolling statistics
orig = plt.plot(timeseries, color='blue',  label='Original')
mean = plt.plot(rolmean,color='red',   label='Rolling Mean')
std  = plt.plot(rolstd, color='black', label='Rolling Std')
plt.legend(loc='best')
plt.title('Rolling Mean and Standard Deviation')
plt.show(block=false)
#perform Dickey=Fuller test
print('Results of Dickey-Fuller Test:')
dftest = adfuller(timeseries, autolag='AIC')
dfoutput = pd.Series(dftest[0:4], index=['Test 
Statistic','p-value','#Lags Used','Number of Observations Used'])

for key, value in dftest[4].items():
dfoutput['Critical Value (%s)'%key]=value
print(dfoutput)
test_stationary(ts

And see this output:
---
ImportError  Traceback (most recent call last)
 in ()
> 1 from statsmodels.tsa.stattools import adfuller
  2 def test_stationarity(timeseries):
  3 #determining rolling statistics
  4 rolmean = pd.rolling_mean(timeseries, window=12)
  5 rolstd  = pd.rolling_std(timeseries, window=12)

c:\python34\lib\site-packages\statsmodels\__init__.py in ()
  6
  7 from warnings import simplefilter
> 8 from .tools.sm_exceptions import (ConvergenceWarning, 
CacheWriteWarning,

  9  IterationLimitWarning, InvalidTestWarning)
 10

c:\python34\lib\site-packages\statsmodels\tools\__init__.py in ()
> 1 from .tools import add_constant, categorical

c:\python34\lib\site-packages\statsmodels\tools\tools.py in ()
  6 import numpy.lib.recfunctions as nprf
  7 import numpy.linalg as L
> 8 from scipy.linalg import svdvals
  9 from statsmodels.distributions import (ECDF, monotone_fn_inverter,
 10StepFunction)

c:\python34\lib\site-packages\scipy\linalg\__init__.py in ()
172 from .linalg_version import linalg_version as __version__
173
--> 174 from .misc import *
175 from .basic import *
176 from .decomp import *

c:\python34\lib\site-packages\scipy\linalg\misc.py in ()
  3 import numpy as np
  4 from numpy.linalg import LinAlgError
> 5 from .blas import get_blas_funcs
  6 from .lapack import get_lapack_funcs
  7

c:\python34\lib\site-packages\scipy\linalg\blas.py in ()
153 import numpy as _np
154
--> 155 from scipy.linalg import _fblas
156 try:
157 from scipy.linalg import _cblas

ImportError: DLL load failed: The specified module could not be found.

Do I read this correctly to mean that the very last import statement is 
the one having the problem,


"from scipy.linalg import _fblas"

How do I troubleshoot this? I'm wondering if I have version conflict 
between two modules.


Thanks,
Mike
--
https://mail.python.org/mailman/listinfo/python-list


Re: from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.

2016-02-09 Thread Mike S via Python-list

On 2/9/2016 1:33 AM, Mark Lawrence wrote:

On 09/02/2016 04:22, Mike S via Python-list wrote:

I have Python 3.4.4 installed on Windows 7, also IPython, scipy, numpy,
statsmodels, and a lot of other modules, and am working through this
tutorial
http://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/


[snip bulk of code and traceback]


 154
--> 155 from scipy.linalg import _fblas
 156 try:
 157 from scipy.linalg import _cblas
ImportError: DLL load failed: The specified module could not be found.
Do I read this correctly to mean that the very last import statement is
the one having the problem,
"from scipy.linalg import _fblas"
How do I troubleshoot this? I'm wondering if I have version conflict
between two modules.


Alomost certainly, hopefully this link will help.
http://stackoverflow.com/questions/21350153/error-importing-scipy-linalg-on-windows-python-3-3


Thanks,
Mike


No problem :)


Mark,

I uninstalled scipy, numpy and pandas, then installed this version
  scipy-0.15.1-win32-superpack-python3.4
I had previously installed this version
  scipy-0.16.1-win32-superpack-python3.4
That solved the conflict, you have great search skills, I tried but 
didn't find a resolution.


Thanks Very Much!
Mike

--
https://mail.python.org/mailman/listinfo/python-list


Re: Cygwin and Python3

2016-02-09 Thread Mike S via Python-list

On 2/9/2016 7:26 PM, Larry Hudson wrote:

On 02/09/2016 08:41 AM, Fillmore wrote:


Hi, I am having a hard time making my Cygwin run Python 3.5 (or Python
2.7 for that matter).
The command will hang and nothing happens.



Just curious...

Since Python runs natively in Windows, why are you trying to run it with
Cygwin?
I'm not implying that you shouldn't, just offhand I don't see a reason
for it.

  -=- Larry -=-



Have you seen this?
http://www.davidbaumgold.com/tutorials/set-up-python-windows/

--
https://mail.python.org/mailman/listinfo/python-list


Re: Cygwin and Python3

2016-02-10 Thread Mike S via Python-list

On 2/10/2016 5:05 AM, Mark Lawrence wrote:

On 10/02/2016 03:39, Mike S via Python-list wrote:

On 2/9/2016 7:26 PM, Larry Hudson wrote:

On 02/09/2016 08:41 AM, Fillmore wrote:


Hi, I am having a hard time making my Cygwin run Python 3.5 (or Python
2.7 for that matter).
The command will hang and nothing happens.



Just curious...

Since Python runs natively in Windows, why are you trying to run it with
Cygwin?
I'm not implying that you shouldn't, just offhand I don't see a reason
for it.

  -=- Larry -=-



Have you seen this?
http://www.davidbaumgold.com/tutorials/set-up-python-windows/



I have now, but I'm perfectly happy with the free versions of Visual
Studio.


I was referring to the procedure in general, and what looked like an 
important step to include.


So it looks like the terminal can find ssh and git, but not python. 
That's understandable, since we didn't use Cygwin to install Python. To 
tell Cygwin how to find Python, run the following command:

$ echo "PATH=\$PATH:/cygdrive/c/Python32" >> .bash_profile

I don't see any references to VS on that page so I don't know what 
you're referring to.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Cygwin and Python3

2016-02-11 Thread Mike S via Python-list

On 2/10/2016 11:46 PM, blindanag...@nowhere.net wrote:

On 10/02/2016 23:05, Mike S wrote:

On 2/10/2016 5:05 AM, Mark Lawrence wrote:


[snip]

Have you seen this?
http://www.davidbaumgold.com/tutorials/set-up-python-windows/



I have now, but I'm perfectly happy with the free versions of Visual
Studio.


[snip]

I don't see any references to VS on that page so I don't know what
you're referring to.


I suspect that Mark is reacting indirectly to the misleading implication
on that page that it is necessary to install Cygwin if you want to
develop Python code on Windows.


Thanks for explaining, I had no idea what that comment might be based on.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-20 Thread Mike S via Python-list

On 2/19/2016 8:58 PM, Denis Akhiyarov wrote:

On Wednesday, February 17, 2016 at 1:49:44 PM UTC-6, wrong.a...@gmail.com wrote:

I am mostly getting positive feedback for Python.

It seems Python is used more for web based applications. Is it equally fine for 
creating stand-alone *.exe's? Can the same code be compiled to run on Linux or 
Android or web-based?

Is it possible to create GUI elements with a good IDE? Can they be defined like 
in Visual Basic with given sizes, fonts, visible/invisible, etc.?

Is it easy to do matrix operations in Python? Or do I need to write subroutines 
like in Visual Basic?

Could someone kindly tell me advantages and disadvantages of Python? Or any 
better options? I have like 40-50 VB Forms and may be around 2 lines of 
code. It will be a task to learn a new language and translate/re-write that 
code.

Thanks for your responses.


I'm surprised that no one mentioned this tool called vb2py.
> It looks outdated, but I actually used it successfully to convert vba 
code to python,> once all dependencies were installed correctly :)

http://vb2py.sourceforge.net/
You can also understand how vb objects map to python objects.
vb2py has also minimal support for GUI conversion.
Someone has even forked it on github recently:
https://github.com/reingart/vb2py


Thanks! I have a lot of VB6 and VB.NET code and I'm learning Python 
thinking about doing machine learning, this might come in handy for 
other programs!

--
https://mail.python.org/mailman/listinfo/python-list


good python tutorial

2016-02-22 Thread Mike S via Python-list
This site was recommended by a friend, it looks really well put 
together, I thought it might be of interest to people considering online 
tutorials.


http://www.python-course.eu/index.php
--
https://mail.python.org/mailman/listinfo/python-list


Python used in several places in LIGO effort

2016-02-24 Thread Mike S via Python-list

https://www.reddit.com/r/IAmA/comments/45g8qu/we_are_the_ligo_scientific_collaboration_and_we/czxnlux?imm_mid=0e0d97&cmp=em-data-na-na-newsltr_20160224
--
https://mail.python.org/mailman/listinfo/python-list


Re: Computational Chemistry Analysis

2016-02-25 Thread Mike S via Python-list

On 2/25/2016 7:31 AM, Oscar Benjamin wrote:

On 25 February 2016 at 01:01, Feagans, Mandy  wrote:

Hi! I am a student interested in conducting computational analysis of 
protein-ligand binding for drug development analysis. Recently, I read of an 
individual using a python program for their studies of protein-ligand binding. 
As I have been reading about Python programs, however, all I have been able to 
find are programs that use the python script (i.e. Autodock). I was hoping to 
see if there were any programs specifically run through the python programming 
that ran similar analysis to Autodock?



You may have better luck asking on the scipy user list:
http://www.scipy.org/scipylib/mailing-lists.html
Those lists are specifically for people doing scientific work with Python.
Oscar


HtH
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3607193/
--
https://mail.python.org/mailman/listinfo/python-list


Speech recognition and synthesi in Python

2016-02-25 Thread Mike S via Python-list

Pretty nice example code...

https://ggulati.wordpress.com/2016/02/24/coding-jarvis-in-python-3-in-2016/
--
https://mail.python.org/mailman/listinfo/python-list


Re: Everything good about Python except GUI IDE?

2016-03-02 Thread Mike S via Python-list

On 2/27/2016 10:13 AM, wrong.addres...@gmail.com wrote:

On Saturday, 27 February 2016 18:08:36 UTC+2, Dietmar Schwertberger  wrote:

On 27.02.2016 12:18, wrong.addres...@gmail.com wrote:

Isn't there any good GUI IDE like Visual Basic? I hope there are some less well 
known GUI IDEs which I did not come across. Thanks.


As of today, there's no Python GUI builder comparable to VB 6.



Thanks for stating this clearly. Everyone here has been trying to show me 
various ways to do the kind of things I will want to, but nobody clearly admits 
the limitations I will have to accept if I start with Python.

I am starting to wonder if VB.net would be a better solution for the time 
being. I have learnt enough VB.net to manage my work but it is bloated and 
Microsoft dependent.


There are some like QtDesigner or wxGlade, but they either don't
generate Python code directly or they can only be used if you know the
underlying toolkit good enough to create the GUI yourself. You may try
out some, but I can almost guarantee you that you will come to the same
result.
If you want a GUI, create it yourself using either wxPython or PyQt.


I will check it. I got the impression that you can create a GUI but that has to 
be converted to Python, and then you need a wrapper to put these forms in, and 
then they can be compiled or converted to *.exe with py2exe. Not a good way for 
development/debugging.



For engineering applications that's probably the weakest point that
Python has.
It's holding back a lot of people...

Well, for most measurement or control software a GUI is not really
needed, but still people want it.



In the 1980s everyone was happy with inputs from the command line on a line 
editor, but today people expect GUIs with graphics and often even animations.
It is surprising that a language which seems very popular does not have GUI 
development infrastructure in place these many years after it got into common 
use.


Regards,
Dietmar


FWIW, I have a lot of VB6 experience, and while I was reluctant to do it 
I did write some VB.NET programs and I have to say, MS did a good job 
with the VS IDE, of course they spent a lot of money on it. I'm learning 
Python to see if I want to do AI/ML work with it because I don't want to 
use Azure, but I'm going to keep using VB6 and VB.NET for desktop 
programs where development time and a GUI is needed, just my preference 
based on my experience.


--
https://mail.python.org/mailman/listinfo/python-list


Re: how do I learn python ?

2015-11-19 Thread Mike S via Python-list

On 11/19/2015 1:00 AM, Michiel Overtoom wrote:



On 18 Nov 2015, at 05:58, 夏华林  wrote:
(nothing)


You might want to start at https://www.python.org/about/gettingstarted/

PS. Leaving the body of an email or usenet article empty is considered bad form.

Greetings,


Thanks for that, there is a great list of tutorials there!
https://wiki.python.org/moin/BeginnersGuide/Programmers

--
https://mail.python.org/mailman/listinfo/python-list


Re: Why won't this run?

2015-11-19 Thread Mike S via Python-list

On 11/15/2015 12:38 PM, jbak36 wrote:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.

#this program says hello and asks for my name
print:('Hello world!')

Hello world!

print:('What is your name?') #ask for their name

What is your name?

myName = input()

print:('It is good to meet you,'+myName)

print:('The length of your name is:')

The length of your name is:

print:(len(myName))

39

print:('What is your age?')#ask for their age

What is your age?

myAge=input()

print:('You will be ' + str(int(myAge)+1)'in a year.')


>>> print("Hello World")
Hello World
>>> myname=input("What is your name? ")
What is your name? John
>>> print ("Your name is ", myname)
Your name is  John

...you can find code samples in the *quick tutorial listed here: 
https://wiki.python.org/moin/BeginnersGuide/Programmers

*http://hetland.org/writing/instant-python.html
--
https://mail.python.org/mailman/listinfo/python-list