Item ID | Begin | End | TestDate | Construction |
1000 | 0 | 1 | 1998 | 2000 |
1001 | 0 | 5 | 2001 | 2000 |
1002 | 1 | 4 | 1998 | 2000 |
1003 | 4 | 5 | 1998 | 2000 |
1004 | 3 | 5 | 2005 | 2000 |
Requirments include:-
- I would like to segment the dataset to eliminate records with older TestDate to Construction date
- Output table should be non overlapping (begin/end)
Should look like below:-
Item ID | Begin | End | TestDate | Construction |
1001 | 0 | 3 | 2001 | 2000 |
1004 | 3 | 5 | 2005 | 2000 |
1002 | 5 | 7 | 1999 | 1998 |
Thanks
Hi Chukwuemeka,
If these are the attributes of a feature class , the following code might help :
import arcpy fc = "c:/data/base.gdb/construct" fields = ('TestDate', 'Construction') with arcpy.da.UpdateCursor(fc, fields) as cursor: for row in cursor: if row[0] < row[1]: cursor.deleteRow ()
Hope you would find this useful.
Thanks so much for the code, i was able to get that part done.
Is there a way either with python scripts or other solution to segment the following table to get the result below?
Input table (not a feature class)
Item ID | Begin | End | TestDate |
1000 | 0 | 1 | 1998 |
1001 | 0 | 5 | 2001 |
1002 | 1 | 7 | 1999 |
1003 | 4 | 5 | 1998 |
1004 | 3 | 5 | 2005 |
Each segmented section (from-to) should have all the item numbers written to a field that is within a certain range. From the input table, the final table should look like the one below:
Output table
Begin | End | TestDate | Item ID | Item ID |
0 | 1 | 1998 | 1000 | 1001 |
1 | 3 | 2001 | 1001 | 1001; 1002 |
3 | 4 | 1999 | 1002 | 1001; 1002; 1004 |
4 | 5 | 1998 | 1003 | 1001; 1002; 1003; 1004 |
5 | 7 | 2005 | 1004 | 1002 |
Again Thanks.
Hi Chukwuemeka,
From the comparing the input table and output table , it is hard for me to find a condition using which the output table is generated.
If you can explain the condition & logic involved in detail , it will be helpful.
This appears to be a duplicate post. The other thread has more responses.