View and use ATCO codes
The ATCO code for an area can be found from the table in the documentation,
or during analysis by using the naptan.ATCO_CODES
package-level variable.
This will display the table as a pandas.DataFrame.
Copied!
import naptan
naptan.ATCO_CODES
import naptan
naptan.ATCO_CODES
Code | Area | Region | Country | |
---|---|---|---|---|
0 | 639 | Aberdeen | S | Sct |
1 | 630 | Aberdeenshire | S | Sct |
2 | 649 | Angus | S | Sct |
3 | 607 | Argyll & Bute | S | Sct |
4 | 18 | Bath & North East Somerset | SW | Eng |
... | ... | ... | ... | ... |
146 | 36 | Windsor & Maidenhead | SE | Eng |
147 | 35 | Wokingham | SE | Eng |
148 | 200 | Worcestershire | WM | Eng |
149 | 514 | Wrexham | W | Wal |
150 | 329 | York | Y | Eng |
151 rows × 4 columns
The table can then be queried, as any pandas DataFrame, to provide the desired ATCO codes.
For example, to get all the Welsh ATCO codes we can query the table.
Copied!
wales = naptan.ATCO_CODES.query('Country == "Wal"')
wales
wales = naptan.ATCO_CODES.query('Country == "Wal"')
wales
Code | Area | Region | Country | |
---|---|---|---|---|
8 | 532 | Blaenau Gwent | W | Wal |
11 | 551 | Bridgend | W | Wal |
15 | 554 | Caerphilly | W | Wal |
17 | 571 | Cardiff | W | Wal |
18 | 522 | Carmarthenshire | W | Wal |
20 | 523 | Ceredigion | W | Wal |
24 | 513 | Conwy | W | Wal |
28 | 511 | Denbighshire | W | Wal |
47 | 512 | Flintshire | W | Wal |
52 | 540 | Gwynedd | W | Wal |
60 | 541 | Isle of Anglesey | W | Wal |
71 | 553 | Merthyr Tydfil | W | Wal |
75 | 533 | Monmouthshire | W | Wal |
83 | 582 | Neath Port Talbot | W | Wal |
84 | 531 | Newport | W | Wal |
99 | 521 | Pembrokeshire | W | Wal |
105 | 561 | Powys | W | Wal |
109 | 552 | Rhondda Cynon Taff | W | Wal |
128 | 581 | Swansea | W | Wal |
133 | 534 | Torfaen | W | Wal |
135 | 572 | Vale of Glamorgan | W | Wal |
149 | 514 | Wrexham | W | Wal |
The ATCO codes can be extracted, and then passed into the naptan.get_area_stops
function, to return data on every NaPTAN stop within Wales.
Copied!
naptan.get_area_stops(wales['Code'])
naptan.get_area_stops(wales['Code'])
ATCOCode | NaptanCode | PlateCode | CleardownCode | CommonName | CommonNameLang | ShortCommonName | ShortCommonNameLang | Landmark | LandmarkLang | ... | TimingStatus | DefaultWaitTime | Notes | NotesLang | AdministrativeAreaCode | CreationDateTime | ModificationDateTime | RevisionNumber | Modification | Status | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 5110ACX17020 | dbgdgtw | NaN | NaN | Westminster Hotel | NaN | NaN | NaN | NaN | NaN | ... | OTH | NaN | NaN | NaN | 16 | 2000-01-01T00:00:00 | 2021-08-15T15:32:32 | 1.0 | revise | active |
1 | 5110ACX17039 | dbgdgdt | NaN | NaN | Morrison | NaN | NaN | NaN | Rhyl Morrison | NaN | ... | OTH | NaN | NaN | NaN | 16 | 2000-01-01T00:00:00 | 2021-08-15T15:32:34 | 2.0 | revise | active |
2 | 5110ANZ12831 | dbgadad | NaN | NaN | Railway Station | NaN | King`s Bridge | NaN | Berwyn Llangollen Railway Stn | NaN | ... | OTH | NaN | NaN | NaN | 16 | 2000-01-01T00:00:00 | 2021-08-15T15:32:35 | 2.0 | revise | active |
3 | 5110ANZ12832 | dbgajmt | NaN | NaN | Station | NaN | NaN | NaN | Glyndyfrdwy Llangollen Station | NaN | ... | OTH | NaN | NaN | NaN | 16 | 2000-01-01T00:00:00 | 2021-08-15T15:32:37 | 1.0 | revise | active |
4 | 5110ANZ12833 | dbgapmd | NaN | NaN | Station | NaN | NaN | NaN | Carrog Llangollen Railway Station | NaN | ... | OTH | NaN | NaN | NaN | 16 | 2000-01-01T00:00:00 | 2021-08-15T15:32:38 | 1.0 | revise | active |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
27245 | 5820WDB48454 | nptmajd | NaN | NaN | Port Talbot Parkway | NaN | Bus Station | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | 34 | 2017-09-21T14:05:50 | 2017-12-11T12:05:59 | 1.0 | revise | active |
27246 | 5820WDB48455 | nptmajg | NaN | NaN | Port Talbot Parkway | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | 34 | 2017-09-21T14:08:48 | 2017-12-11T12:03:40 | 1.0 | revise | active |
27247 | 5820WDB48456 | nptmajm | NaN | NaN | Port Talbot Parkway | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | 34 | 2017-09-21T14:11:27 | 2017-12-11T11:58:19 | 1.0 | revise | active |
27248 | 5820WDB48458 | nptmajw | NaN | NaN | Aberavon Cinema | NaN | NaN | NaN | NaN | NaN | ... | OTH | NaN | NaN | NaN | 34 | 2018-07-18T10:16:01 | 2018-07-18T09:45:15 | NaN | new | active |
27249 | 5820WDB48459 | nptmamg | NaN | NaN | Dulais Valley Surgery | NaN | Surgery | NaN | M W Phillips Chemist | NaN | ... | OTH | NaN | NaN | NaN | 34 | 2020-03-12T10:23:20 | 2020-11-23T21:17:14 | 2.0 | revise | active |
27250 rows × 43 columns