lbb220

How get the data matrix in the order of "FID" from the fields of shpfile

Discussion created by lbb220 on Dec 27, 2012
Latest reply on Jul 7, 2013 by dannyrough
I am scripting with python and ArcGIS 10.1. I want to get fied data from the shpfile, what I did are as follows:

ssdo = SSDO.SSDataObject(inputFC, templateFC=OutputFC)
masterField = UTILS.setUniqueIDField(ssdo, weightsFile=DistM)
self.allVars = [self.DeVar] + self.IndeVars
ssdo.obtainDataGA(masterField, self.allVars, minNumObs=5, warnNumObs=20)
self.y = ssdo.fields[self.DeVar].returnDouble()
self.x = NUM.ones((self.dp_n, self.var_n), dtype=float)
for i in range(1, self.var_n):
      self.x[:, i] = ssdo.fields[self.IndeVars[i - 1]].returnDouble()
....................

BUT I found the populated "y" and "x" data is not in the order of "FID",  for example:

In the original shpfile,
    (Intercept) FLOORSZ
0             1      54
1             1      82
2             1      65
3             1      90
4             1     132
5             1      76
6             1      56
7             1      76
8             1      48
9             1      45
10            1      87

BUT in the populated "x" data:
[   1.   80.]
[   1.   94.]
[   1.  150.]
[   1.   97.]
[   1.   83.]
[   1.   98.]
[   1.  254.]
[   1.  108.]
[   1.   80.]
[   1.  194.]


Anyone can tell me what happened here? And how can I make the populated data are in the order of FID?

Many many thanks!

Outcomes