Re: [Tutor] Fwd: RE: Fwd: Re: Sklearn

2017-03-11 Thread Matt Williams
Having done similar, the options are (depending on the dataset): 1: Python to read, clean and classify data, then R to do the analysis (e.g. regression analysis) 2: Python to read, clean and classify data, and python for the analysis 3: All in R If you want to use Python for the analysis, most

Re: [Tutor] Created Function, Need Argument to be a String

2016-12-17 Thread Matt Williams
Use the str() function. M On Thu, 15 Dec 2016, 07:56 Bryon Adams, wrote: > Is there a way to force my argument to always be a string before > entering the function? Else, is there a better way to go about this? In > whatever program I write, I could change what I

[Tutor] Advice on multi-dimensional data storage

2016-03-16 Thread Matt Williams
Dear Tutors, I am looking for some advice. I have some data that has three dimensions to it. I would like to store it such that one could manipulate (query/ update/ etc.) by dimension - so it would be feasible to ask for all of the data that shares a value in d1, or iterate over all of the values

Re: [Tutor] Citing Python

2016-03-15 Thread Matt Williams
No, but in his defence, I can imagine someone reading the dissertation and asking for a citation.. (Apologies for TP). M On 15/03/2016 18:43, Alan Gauld wrote: On 15/03/16 11:45, Holderness, Ellie wrote: How do I cite Python for my dissertation bibliography? I used version 3.5.1. I'm not

Re: [Tutor] Recommendations for best tool to write/run Python

2016-03-02 Thread Matt Williams
Can someone recommend an open-source editor for all 3 platforms? M On Wed, 2 Mar 2016 21:37 Ben Finney, wrote: > Ben Finney writes: > > > Short of [the heavyweights Vim and Emacs], I'd still recommend a > > community-owned,

Re: [Tutor] Recommendations for best tool to write/run Python

2016-03-02 Thread Matt Williams
I teach an introductory programming course to medical students (and a few doctors). I would look at Sublime Text 2 if one Windows/ Mac. Has a 'nag' screen to remind you to buy, but feels simple enough when you start it. M On Wed, 2 Mar 2016 19:50 Ben Finney, wrote:

Re: [Tutor] Enumerate vs DictReader object manipulation:

2016-02-04 Thread Matt Williams
Just as a note - you are not the only person caught out by this - it is a very common slip. I wonder whether it would be worth adding a more explicit line about this in the Python Docs? Matt On Wed, 3 Feb 2016 16:13 Ek Esawi wrote: > Hi All > > > > > > I have a code that

Re: [Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-28 Thread Matt Williams
This is a problem I have come up against often, and I don't think I have a good answer, so if anyone else does, I would be glad to hear it! I would be tempted to generate a 'test data.CSV" file, and run the tests on that. It means that as you write the code, and find some edge cases, you can

Re: [Tutor] python help

2015-07-06 Thread Matt Williams
Personally I would start with Python 2.7, and start with simple scripts. The standard library in Python is very wide, and having a good understanding of what is already there is very useful. As to GUI/ Web/ etc. - I think it depends on what you want to do. However, you will need the basics

Re: [Tutor] newb help reading lines from csv

2012-10-26 Thread Matt Williams
Dear Rob, This caught me out as well for a long time. As I understand it, csv.reader is a file-reader, which iterates ONCE over the file. There may be more elegant solutions, but I do: import csv ifile = open('test.csv', r) reader = csv.reader(ifile) inData = [] for row in reader:

Re: [Tutor] extract specific column

2011-10-12 Thread Matt Williams
On 12/10/2011 18:21, Anna Olofsson wrote: Hi, I'm a beginner at python and I'm trying to extract a specific column from a txt file ( see attached file). In the attached file I want to extract the entire column/pph2_prob /(i.e. column 16). But I want to get all the values from that column

Re: [Tutor] Merging Text Files

2010-10-13 Thread Matt Williams
Dear Ara, I have been working on something similar. In the end I used a dictionary for each line in the file, and stored data from each file in a different set. I then matched using one (or more) element from each dictionary. This is really very close doing a join in a database, though, and

[Tutor] Lexicographic ordering (or something simpler)

2007-03-13 Thread Matt Williams
Dear All, I'm trying to write something to calculate rule priorities, based on their provenance (ultimately I'm after a lexicographic ordering) I have a set of terms (the provenances) I'm try to sort. I've done it by associating each possible set of terms with a dictionary, and then using the

[Tutor] Sorting a list in an add order

2006-09-06 Thread Matt Williams
Dear List, I've written a small script to extract the definitions from my thesis, and output them as a .tex file, which works ok but I have a small problem. The input is done by specifying a directory, and using glob to find the .tex filenames. However, I want to process them so that they are

[Tutor] Regex

2006-08-14 Thread Matt Williams
Dear All, I know this has come up loads of times before, but I'm stuck with what should be a simple Regex problem. I'm trying to pull all the definitions from a latex document. these are marked \begin{defn} TEXT \end{defn} so I thought I'd write something like this: filename =

[Tutor] (*args, **kwargs)

2006-08-04 Thread Matt Williams
Dear All, I have learnt to do bits of python, but one of the things I cannot get my head around is the *args, **kwargs syntax. I have tried reading stuff on the web, and I have a copy of the python cookbook (which uses it as a recipe early on) but I still don't understand it. Please could

Re: [Tutor] (*args, **kwargs)

2006-08-04 Thread Matt Williams
Dear Etienne Carlos, Thanks so much for that - much clearer! I guess the next question is _how_ do you use it intelligently? I'm interested because I'm trying to put stuff into a db using sqlobject. Obviously one way would be: class MyClass: def __init__(self,**kw)

Re: [Tutor] Python DB

2006-02-07 Thread Matt Williams
You might also want to have a look at DABO; I don't know how well it work on a handheld, though. http://dabodev.com/about Matt ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Python on Fedora

2006-01-24 Thread Matt Williams
FC4 (the latest finished one) has python 2.4.1 as part of the distro (I think RedHat actually use python for some of their scripts). Just pull up a terminal and type 'python' and you should get the prompt... If you _are_ running FC4 and have more probs, feel free to drop me a line. at matt at

[Tutor] Favourite Modules - wiki

2005-11-15 Thread Matt Williams
I think the Wiki's a great idea. del.icio.us already has a Python tagged page: http://del.icio.us/tag/python Other pages I use are: http://mechanicalcat.net/pyblagg.html http://www.planetpython.org/ I've added a couple of things to the Wiki - SQLObject and RSPython Matt

[Tutor] TurboGears - and some issues

2005-11-14 Thread Matt Williams
Dear Alan, I haven't used it, but I've looked through it, and it looks v. interesting. One of the things I like is that it glues lots of different bits together (I came across it while looking at SQLObject), and so benefits from their advances. This bit is meant as a complimentI was a bit

Re: [Tutor] Symbolic maths In Python

2005-11-13 Thread Matt Williams
I don't know if this will do anywhere near what you want... http://swiginac.berlios.de/ is a set of Python bindings to GiNaC, which handles symbolic maths in C/C++. Matt ___ Tutor maillist - Tutor@python.org

[Tutor] Latin Perl

2005-11-10 Thread Matt Williams
The suprising thing about Latin Perl is that it's more readable than normal Perl Matt ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python and Semantic Web

2005-11-08 Thread Matt Williams
Mea Culpa, Mea Culpa, Mea Maxima Culpa (or, MCMCMMC to repeat my sin of poly-acronymony. Semantic Web - (loosely) the idea of incorporating semantic information in the WWW, so it becomes machine understandable (rather than just parsable). CWM is Tim Berners-Lee's (and others) tool to handle

[Tutor] Easier way to access wxPython

2005-11-07 Thread Matt Williams
Dear All, Just a note: When the next question about which GUI for Python comes around (and I should plead guilty to having asked a few times) I thought that the Dabo framework, which wraps wxPython in a nicer API would be worth pointing to. And even if the question didn't get asked, I thought

[Tutor] Mono

2005-11-07 Thread Matt Williams
Dear List, Slightly off topic, but could someone explain/ point me to a URL that explains how one might use Python with Mono (I guess it would be IronPython, rather than CPython), and what advantages it might give you (apart from a possible speed up of IronPython vs. CPython). I'm especially

[Tutor] Nokia 60 series

2005-10-29 Thread Matt Williams
There's some extra info here: http://comments.gmane.org/gmane.comp.python.announce/5658 HTH, Matt -- Dr. M. Williams MRCP(UK) Clinical Research Fellow Cancer Research UK +44 (0)207 269 2953 +44 (0)7834 899570 http://acl.icnet.uk/~mw http://adhominem.blogspot.com

[Tutor] General programming questions

2005-10-27 Thread Matt Williams
Dear List, I've got a few general programming (not really specific to python, although you're all so helpful, I thought I'd ask here). I understand some of these are a bit long, so if you could just point me to some resources, I'd be very grateful. 1: I need to create objects that have variable

Re: [Tutor] Tutor Digest, Vol 20, Issue 26: New Python Book

2005-10-08 Thread Matt Williams
IMHO, as regards the book using wxPython, rather than Tkinter: I've failed to get Tkinter to compile on several installs, whereas I can usually get wxPython to work. Also, wx seems to be better documented.I know it's not ideal to pick one platform, but I would guess that wx would be a

[Tutor] Accessing Variables

2005-10-05 Thread Matt Williams
Dear List, I'm trying to clarify something about accessing variables. If I have ONE.py file with some variable a, and ONE imports TWO, which has a variable b, can TWO access variable a (I don't think so, but I just thought I'd check). I guess the way round this is just to make some classes

[Tutor] Python DB

2005-09-22 Thread Matt Williams
Dear List, Thanks for all the advice! Obviously, I'm still a bit torn, but some of the ideas looked good. In terms of spec, the DB can be fairly simple (single access, etc.). Lower dependency on other libraries is good. Also, it needs to be cross- platform. The problem (I have) with SQL-type DB

Re: [Tutor] IDEs

2005-09-14 Thread Matt Williams
I've used both PyDev and Wing IDE. PyDev seems good, and is getting better. Wing is pay-for (although only $40 or so), but can be trialled. I thought it was good, but had a huge problem trying to get it to play with a C library I was using... I've never managed to get Boa-Constructor to run...

[Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Matt Williams
Dear List, Does anyone know of a Python FTP GUI tool ? Preferably based around pyGTK+ ? I've had a look (Google, vaults of Parnassus, etc.) but haven't found one. If there isn't one, then would people consider it a useful project for newbie programmers (like myself). There have often been

[Tutor] Filtering a String

2005-03-20 Thread Matt Williams
- until I realised I was sending all the desperate pleas for help to tutor-request. Perhaps there is no hope.. Matt Williams ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Database

2005-02-11 Thread Matt Williams
I would recommend KirbyBase as a quick starter - it's nice and simple, and outputs text files, so you can always check things manually. http://www.netpromi.com/kirbybase.html Matt ___ Tutor maillist - Tutor@python.org

[Tutor] Nifty

2004-12-17 Thread Matt Williams
I'd be interested, Matt On Fri, 2004-12-17 at 11:01, [EMAIL PROTECTED] wrote: Send Tutor mailing list submissions to [EMAIL PROTECTED] To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/tutor or, via email, send a message with

[Tutor] How to find complex roots

2004-12-09 Thread Matt Williams
Dick Mores wrote: snip My trusty $10 Casio calculator tells me that the 3 cube roots of 1 are: 1, (-.5 +0.866025403j), and (-.5 -0.866025403j), or thereabouts. Is there a way to do this in Python? snip I think the neatest approach might be to consider that the n-complex roots form at equal

[Tutor] Complex roots

2004-12-09 Thread Matt Williams
Further to my previous post, please find some code below: Hope this helps, Matt #Complex number Roots #Matt Williams 9.12.04 import math number=complex(0.5,0) n=float(3) size=math.sqrt((number.real**2)+(number.imag**2)) arg=math.radians(360/n) root=1/n modulus=size**root theta=float(0