frequency of values in a field
noydb
jenn.duerr at gmail.com
Wed Feb 9 15:39:46 EST 2011
On Feb 9, 3:08 pm, Josh English <Joshua.R.Engl... at gmail.com> 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 the arggisscripting module. long_list is a list with the records you want, or an iterator that goes through the records. The get_key function does whatever you need it to do to get the key by which you are counting.
>
> Andreas offers a nice pythonic solution in this thread.
>
> Josh
I apologize if I am not being clear. Bear with me, I am not a
programmer by trade, just someone who has to delve into some python
scripting occasionally (which I do enjoy!).
No, I do not mean "use no imports whatsoever". Just don't want to use
ArcGIS sw's module arcgisscritping -- fine to use when needed for GIS
processing, but some of my scripts do not need it whatsoever, as I
suspect in this case. I have a solution in place, which is fine, but I
used arcgisscripting simply to put a search cursor on that field to
get the values. This certainly can be done without arcgisscripting,
which does add a bit of time to the running of the script. i just do
not know how outside of using arcgisscripting search cursor. Just
looking to learn how...
So, in my scenario, taking into account suggested snippets above....
long_list would start out empty. The values to go into long_list are
in one field in a dbf table that contains thousands of records. I
need to create a text file containing all the frequencies of values
(only to 2 decimal places... in the form "key count"). How do I get
those values from the field into the empty list so that this code.
Everything else is figured out (textfile, getting the frequencies (per
suggestions above)) - just want to know how to add all the values in
the column into the empty list?
More information about the Python-list
mailing list