On Feb 9, 3:28 pm, Ethan Furman wrote:
> noydb wrote:
>
> > Paul Rubin wrote:
>
>
>
>
>
> >> The Decimal module is pretty slow but is conceptually probably the right
> >> way to do this. With just 50k records it shouldn't be too bad. With
> >> more records you might look for a faster way.
>
> >
On Feb 9, 3:08 pm, Josh English wrote:
> On Wednesday, February 9, 2011 10:34:12 AM UTC-8, noydb wrote:
>
> > How do you add all the records in the particular field of interest
> > into long_list?
>
> Sorry to be unclear. In both cases I was tossing out pseudo-code, as I am not
> familiar with th
noydb wrote:
> Paul Rubin wrote:
The Decimal module is pretty slow but is conceptually probably the right
way to do this. With just 50k records it shouldn't be too bad. With
more records you might look for a faster way.
from decimal import Decimal as D
from collections import defaultdi
On Wednesday, February 9, 2011 10:34:12 AM UTC-8, noydb wrote:
>
> How do you add all the records in the particular field of interest
> into long_list?
Sorry to be unclear. In both cases I was tossing out pseudo-code, as I am not
familiar with the arggisscripting module. long_list is a list wit
> How do you add all the records in the particular field of interest
> into long_list?
>From earlier in the thread you did...
import arcgisscripting
# Create the geoprocessor object
gp = arcgisscripting.create()
records_list = []
cur = gp.SearchCursor(dbfTable)
row = cur.Next()
while row:
valu
noydb writes:
>> counts = {}
>> for thing in long_list:
>> key = make_key(thing)
>> if key in counts:
>> counts[key] += 1
>> else:
>> counts[key] = 1
counts = {}
for thing i long_list:
key = make_key(thing)
counts[key] = 1 + counts.get(key, 0)
> How do you add all the records i
On Feb 9, 1:21 pm, Josh English wrote:
> On Wednesday, February 9, 2011 9:52:27 AM UTC-8, noydb wrote:
>
> > So it seems the idea is to add all the records in the particular field
> > of interest into a list (record). How does one do this in pure
> > Python?
> > Normally in my work with gis/arcgi
On Wednesday, February 9, 2011 9:52:27 AM UTC-8, noydb wrote:
>
> So it seems the idea is to add all the records in the particular field
> of interest into a list (record). How does one do this in pure
> Python?
> Normally in my work with gis/arcgis sw, I would do a search cursor on
> the DBF fi
>
> The Decimal module is pretty slow but is conceptually probably the right
> way to do this. With just 50k records it shouldn't be too bad. With
> more records you might look for a faster way.
>
> from decimal import Decimal as D
> from collections import defaultdict
>
> records = [
2011/2/8, Paul Rubin :
> noydb writes:
>> I am looking for ways to go about capturing the frequency of unique
>> values in one field in a dbf table which contains ~50k records. The
>> values are numbers with atleast 5 digits to the right of the decimal,
>> but I want the frequency of values to on
noydb writes:
> I am looking for ways to go about capturing the frequency of unique
> values in one field in a dbf table which contains ~50k records. The
> values are numbers with atleast 5 digits to the right of the decimal,
> but I want the frequency of values to only 2 decimal places. I do
>
You could try a collections.defaultdict object with an integer as the startup
value:
counts = collections.defaultdict(int)
for thing in long_list:
counts[get_last_two_digits(thing)] += 1
This assumes get_last_two_digits is the function that provides the key you want
to count by. I'm not sure
I am looking for ways to go about capturing the frequency of unique
values in one field in a dbf table which contains ~50k records. The
values are numbers with atleast 5 digits to the right of the decimal,
but I want the frequency of values to only 2 decimal places. I do
have a method to do this
13 matches
Mail list logo