作者ryoma0915 (芸~)
看板Python
標題[問題] 如何在dbf檔中進行資料比對?
時間Tue Jun 10 22:26:54 2014
我有一個這樣的dbf檔
http://ppt.cc/nupm
AREA X Y id
201144.20807 203500.00000 2535500.00000 2
410470.48979 204500.00000 2535500.00000 2
96374.47460 199500.00000 2533500.00000 2
118790.12873 196500.00000 2531500.00000 2
157389.24175 195500.00000 2530500.00000 2
514871.81518 196500.00000 2530500.00000 2
259449.53306 195500.00000 2529500.00000 2
602155.49015 196500.00000 2529500.00000 2
我想要找出 x y 相同的座標點
然後area 要進行相加
這是我的code
http://pastebin.com/4uwLj83F
想問大家哪裡錯誤呢?
謝謝大家^^
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.134.158
※ 文章網址: http://www.ptt.cc/bbs/Python/M.1402410419.A.3D9.html
推 tiefblau:你27行的& 是要表達邏輯的and嗎? 06/10 22:40
→ ryoma0915:恩恩 想表達and 06/10 22:41
→ tiefblau:'&':binary AND operator, 'and':logical AND operator 06/10 22:45
→ ryoma0915:TypeError: range() integer end argument expected, 06/10 22:49
→ ryoma0915:got float. 我一值得到TypeError 06/10 22:50
推 Neisseria:妳是想找 rec['X'] == rec['Y'] 嗎?不是很懂妳的源碼 06/10 22:54
→ ryoma0915:我想要找(x0,y0) = (x1,y1)就是座標相同的area相加 06/10 22:58
→ KSJ:你這是GIS嗎?? 06/10 23:03
→ ryoma0915:嗯啊是gis匯出來的資料 06/10 23:07
→ KSJ:應該有shp檔吧 建議用postgis/postgresql直接SQL比較方便 06/10 23:38
→ KSJ:你的需求是SQL一次搞定的呢~ 06/10 23:38