Re: Selecting unique values

2011-07-26 Thread sparky gmail

On 7/25/2011 3:03 PM, Kumar Mainali wrote:

Greetings

I have a dataset with occurrence records of multiple species. I need 
to get rid of multiple listings of the same occurrence point for a 
species (as you see below in red and blue typeface). How do I create a 
dataset only with unique set of longitude and latitude for each 
species? Thanks in advance.


Species_nameLongitudeLatitude
Abies concolor-106.60135.868
Abies concolor-106.49335.9682
Abies concolor-106.48935.892
Abies concolor-106.49635.8542
Accipiter cooperi-119.68834.4339
Accipiter cooperi-119.79234.5069
Accipiter cooperi-118.79734.2581
Accipiter cooperi-77.389.68333
Accipiter cooperi-77.389.68333
Accipiter cooperi-75.9915340.65
Accipiter cooperi-75.9915340.65

- Kumar
It would seem to me that what you are wanting is a dictionary where the 
species name is the key and the value is a list of Long/Lat


So assuming your data is in a list like so (such as you might get from 
reading lines from a file) ['Abies concolor-106.60135.868', 'Abies 
concolor-106.49335.9682']


You could say

output = dict()
for record in my_long_list:
values = record.rsplit(' ', 2)
key = values[:1]
value = ' '.join(values[1:])
try:
 output[key].append(value)
 except KeyError:
 output[key] = [value]


Something like that should do.


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


Re: Community Involvement

2011-08-04 Thread sparky gmail

On 8/3/2011 8:14 PM, Steve Holden wrote:

[Ccs appreciated]

After some three years labor I (@holdenweb) at last find myself 
approaching the completion of the Python Certificate Series with 
O'Reilly School of Technology (@OReillySchool).


At OSCON last week the team fell to talking about the final assignment 
(although the Certificate is not a certification, students only 
progress by answering real quiz questions, not the usual 
multiple-choice task). Success also requires that they complete a 
project at the end of each (of the ~60) lesson(s).


We would ideally like the last project to to be something that 
demonstrates at least some minimal involvement with the Python 
community. Something like "get a Python answer upvoted on 
StackOverflow", for example, or getting a question answered on c.l.p. 
At the same time it shouldn't be anything that places a burden on the 
community (otherwise the hundredth student would be abused and the 
thousandth murdered).


So I wondered if anyone had any good ideas.

regards
 Steve
--
Steve Holden
[email protected] 




Just a thought.

What about contributing code or documentation to an established project?

I dislike the idea of getting an answer up voted. First of all, for 
people trying to do it honestly you are putting
their completion into the hands of strangers, secondly, it would be very 
easy to cheat by having someone else,

or themselves with a puppet account, up vote the answer.

There are a metric grip of established projects that could use a little 
help with documentation, code examples, etc.

I think this is a better route to community participation.
-- 
http://mail.python.org/mailman/listinfo/python-list