Re: [Tutor] Get a single random sample

2011-09-09 Thread Alan Gauld
On 09/09/11 11:44, kitty wrote: ...I have been an R user for 7 years and and am finding it difficult to do even basic things in python, If you are trying to do the kinds of things that R is good at in Python you will find it involves a lot more work. That's because Python is a general purpos

Re: [Tutor] Get a single random sample

2011-09-09 Thread Steven D'Aprano
Peter Otten wrote: Steven D'Aprano wrote: # Get ten random samples, sampling with replacement. samples = [random.choice(subset) for i in range(10)] That may include subset items more than once. Hence the "sampling with replacement" comment. Use the aptly named random.sample(subset, 10

Re: [Tutor] Get a single random sample

2011-09-09 Thread Peter Otten
Peter Otten wrote: > Steven D'Aprano wrote: > >> # Get ten random samples, sampling with replacement. I can quote. But not read ;( >> samples = [random.choice(subset) for i in range(10)] Sorry for the noise. ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] Get a single random sample

2011-09-09 Thread Peter Otten
Steven D'Aprano wrote: > # Get ten random samples, sampling with replacement. > samples = [random.choice(subset) for i in range(10)] That may include subset items more than once. Use the aptly named random.sample(subset, 10) to avoid that. ___ Tu

Re: [Tutor] Get a single random sample

2011-09-09 Thread Peter Otten
kitty wrote: > Hi, > > I'm new to python and I have read through the tutorial on: > http://docs.python.org/tutorial/index.html > which was really good, but I have been an R user for 7 years and and am > finding it difficult to do even basic things in python, for example I want > to import my data

Re: [Tutor] Get a single random sample

2011-09-09 Thread Steven D'Aprano
kitty wrote: I'm new to python and I have read through the tutorial on: http://docs.python.org/tutorial/index.html which was really good, but I have been an R user for 7 years and and am finding it difficult to do even basic things in python, for example I want to import my data (a tab-delimited

Re: [Tutor] Get a single random sample

2011-09-09 Thread Dave Angel
On 09/09/2011 06:44 AM, kitty wrote: Hi, I'm new to python and I have read through the tutorial on: http://docs.python.org/tutorial/index.html which was really good, but I have been an R user for 7 years and and am finding it difficult to do even basic things in python, for example I want to imp