samyakbayar commited on
Commit
224d50a
·
verified ·
1 Parent(s): ac68c07

Upload world-postal-codes dataset files with full metadata

Browse files
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ postal_codes.csv filter=lfs diff=lfs merge=lfs -text
KAGGLE.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # World Postal Code Directory
2
+
3
+ **Subtitle:** 1,835,923 postal codes in 124 countries with coordinates & hierarchy
4
+
5
+ **Tags:** `tabular`, `geography`, `world`
6
+
7
+ **Dataset File:** `postal_codes.csv` (1,835,923 rows, 29 columns, 271.3 MB)
8
+
9
+ **Provenance & Source:** GeoNames Postal Code Database (geonames.org)
10
+
11
+ **Expected Update Frequency:** `annually`
12
+
13
+ ---
14
+
15
+ ## 📖 Description
16
+
17
+ ### Postal codes as a geographic index
18
+
19
+ GeoNames' `allCountries` postal code export is one of the few open, global postal-code lists.
20
+ This dataset contains **1,835,923 postal-code records in 124 countries**, with **29 parameters**
21
+ per record and duplicates removed on country + code + place + admin1.
22
+
23
+ - **Address hierarchy** — country, postal code, place name, admin1/admin2/admin3 names and codes,
24
+ plus an `admin_depth` count.
25
+ - **Geography** — latitude/longitude, hemisphere, 10-degree latitude band, 15-degree longitude band and
26
+ a 9-character geohash.
27
+ - **Code shape** — length, numeric flag, two-character prefix, first character.
28
+ - **Quality** — GeoNames accuracy code and label, plus admin2/admin3 presence flags.
29
+ - **Country context** — country name, World Bank region and subregion.
30
+
31
+ **1,128,319 codes are purely numeric**, while the rest use letters or mixed formats. The
32
+ file supports geocoding, delivery-zone analysis, regional segmentation and postal-format research.
33
+
34
+ ## 🧾 Columns (29)
35
+
36
+ `country_code`, `postal_code`, `place_name`, `admin1_name`, `admin1_code`, `admin2_name`, `admin2_code`, `admin3_name`, `admin3_code`, `latitude`, `longitude`, `accuracy`, `country_name`, `country_region`, `country_subregion`, `postal_length`, `is_numeric_postal`, `postal_prefix`, `postal_first_char`, `hemisphere`, `latitude_band`, `longitude_band`, `accuracy_label`, `has_admin2`, `has_admin3`, `admin_depth`, `place_word_count`, `place_name_length`, `geohash`
37
+
38
+ ## 💡 Ideas for using this data
39
+
40
+ 1. **Postal formats** — cluster countries by code length and character mix.
41
+ 2. **Geocoding** — join to any address table on country + postal code; measure match rates.
42
+ 3. **Population proxies** — count codes per admin1 area as a proxy for settlement density.
43
+ 4. **Spatial clustering** — geohash prefixes make it easy to bin codes into map tiles.
44
+ 5. **Prefix hierarchies** — check whether the first one or two characters map cleanly to regions.
45
+ 6. **Data quality** — compare GeoNames accuracy classes across countries.
46
+ 7. **Missing middle** — countries with no admin2 data; what does that imply for address matching?
47
+ 8. **Place-name NLP** — tokenise place names to find common suffixes (ville, stad, burg, -pur).
48
+ 9. **Map visualisation** — plot all coordinates coloured by region (use a sample for speed).
49
+
50
+ ## 📁 Files
51
+
52
+ | File | What it is |
53
+ |---|---|
54
+ | `postal_codes.csv` | 1,835,923 postal records x 29 parameters. |
55
+ | `data_dictionary.csv` | Column / type / description for every field. |
56
+ | `notebook.ipynb` | Starter notebook that loads the CSV and analyses it. |
57
+ | `dataset-metadata.json` | Kaggle API metadata. |
58
+ | `about.md` | Plain-text About block. |
59
+
60
+ ## 🏷️ Tags
61
+
62
+ `postal-codes`, `geography`, `geocoding`, `geonames`, `addresses`, `world`, `tabular`
63
+
64
+ ## 🔗 Provenance
65
+
66
+ - **Source:** **GeoNames** postal code export,
67
+ `https://download.geonames.org/export/zip/allCountries.zip` (creative commons attribution).
68
+ - **Format:** tab-separated, 12 fields per line: country code, postal code, place name, admin1
69
+ name/code, admin2 name/code, admin3 name/code, latitude, longitude, accuracy.
70
+ - **Processing:** exact duplicates removed, country names and World Bank regions joined, bands,
71
+ code-shape fields and geohashes derived.
72
+ - **Snapshot date:** 22 November 2026.
73
+
74
+ ## 🔄 Update frequency
75
+
76
+ **Daily upstream; snapshot here.** GeoNames refreshes the postal export regularly.
77
+
78
+ ## ⚠️ Caveats
79
+
80
+ - Postal code systems differ wildly: some countries have none, others map one code to many places.
81
+ - Coordinates are place centroids, not rooftop locations; accuracy varies by country.
82
+ - GeoNames is community-maintained and coverage is uneven outside Europe and North America.
83
+ - Duplicate removal is on country + code + place + admin1, so genuinely repeated codes remain.
84
+ - Codes are formatted as nationally used; no normalisation (spaces, hyphens) is applied.
85
+ - Row order follows the upstream file (country, then code), not any ranking.
86
+ - This file is large; notebook cells should sample or filter before plotting.
87
+
88
+ ## 📜 Licence
89
+
90
+ GeoNames data is licensed CC BY 4.0 — attribution to GeoNames is required.
91
+
92
+ ### 📋 Column Definitions & File Header
93
+
94
+ | # | Column Name | Data Type | Description |
95
+ |---|---|---|---|
96
+ | 1 | `country_code` | `string` | ISO 3166-1 alpha-2 country code. |
97
+ | 2 | `postal_code` | `string` | Postal code as used nationally (may contain letters, spaces or hyphens). |
98
+ | 3 | `place_name` | `string` | Primary place name for the code. |
99
+ | 4 | `admin1_name` | `string` | First-level administrative division (state, region, province). |
100
+ | 5 | `admin1_code` | `number` | GeoNames code for the first-level division. |
101
+ | 6 | `admin2_name` | `string` | Second-level division (county, district). |
102
+ | 7 | `admin2_code` | `number` | GeoNames code for the second-level division. |
103
+ | 8 | `admin3_name` | `string` | Third-level division (municipality, commune). |
104
+ | 9 | `admin3_code` | `number` | GeoNames code for the third-level division. |
105
+ | 10 | `latitude` | `number` | Latitude of the place centroid (decimal degrees). |
106
+ | 11 | `longitude` | `number` | Longitude of the place centroid (decimal degrees). |
107
+ | 12 | `accuracy` | `number` | GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid. |
108
+ | 13 | `country_name` | `string` | Country common name. |
109
+ | 14 | `country_region` | `number` | World Bank region. |
110
+ | 15 | `country_subregion` | `number` | World Bank subregion. |
111
+ | 16 | `postal_length` | `number` | Number of characters in the postal code. |
112
+ | 17 | `is_numeric_postal` | `boolean` | true when the code contains only digits. |
113
+ | 18 | `postal_prefix` | `string` | First two characters of the postal code (sorting/region prefix). |
114
+ | 19 | `postal_first_char` | `string` | First character of the postal code. |
115
+ | 20 | `hemisphere` | `string` | N/S + E/W hemisphere pair. |
116
+ | 21 | `latitude_band` | `string` | 10-degree latitude band. |
117
+ | 22 | `longitude_band` | `string` | 15-degree longitude band. |
118
+ | 23 | `accuracy_label` | `string` | Human-readable accuracy class. |
119
+ | 24 | `has_admin2` | `boolean` | true when a second-level division is recorded. |
120
+ | 25 | `has_admin3` | `boolean` | true when a third-level division is recorded. |
121
+ | 26 | `admin_depth` | `number` | Number of administrative levels present (1-3 plus country). |
122
+ | 27 | `place_word_count` | `number` | Words in the place name. |
123
+ | 28 | `place_name_length` | `number` | Characters in the place name. |
124
+ | 29 | `geohash` | `string` | 9-character geohash of the coordinates (spatial joins, binning). |
125
+
126
+
127
+
128
+ ---
129
+
130
+ ## 🌟 Support & Community
131
+ If you find this dataset valuable for your research, machine learning projects, or data explorations, **please give it an upvote (👍) on Kaggle!**
132
+ Feedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.
README.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - tabular
5
+ tags:
6
+ - tabular
7
+ pretty_name: World Postal Code Directory
8
+ ---
9
+
10
+ # World Postal Code Directory
11
+
12
+ **Subtitle:** 1,835,923 postal codes in 124 countries with coordinates & hierarchy
13
+
14
+ **Tags:** `tabular`, `geography`, `world`
15
+
16
+ **Dataset File:** `postal_codes.csv` (1,835,923 rows, 29 columns, 271.3 MB)
17
+
18
+ **Provenance & Source:** GeoNames Postal Code Database (geonames.org)
19
+
20
+ **Expected Update Frequency:** `annually`
21
+
22
+ ---
23
+
24
+ ## 📖 Description
25
+
26
+ ### Postal codes as a geographic index
27
+
28
+ GeoNames' `allCountries` postal code export is one of the few open, global postal-code lists.
29
+ This dataset contains **1,835,923 postal-code records in 124 countries**, with **29 parameters**
30
+ per record and duplicates removed on country + code + place + admin1.
31
+
32
+ - **Address hierarchy** — country, postal code, place name, admin1/admin2/admin3 names and codes,
33
+ plus an `admin_depth` count.
34
+ - **Geography** — latitude/longitude, hemisphere, 10-degree latitude band, 15-degree longitude band and
35
+ a 9-character geohash.
36
+ - **Code shape** — length, numeric flag, two-character prefix, first character.
37
+ - **Quality** — GeoNames accuracy code and label, plus admin2/admin3 presence flags.
38
+ - **Country context** — country name, World Bank region and subregion.
39
+
40
+ **1,128,319 codes are purely numeric**, while the rest use letters or mixed formats. The
41
+ file supports geocoding, delivery-zone analysis, regional segmentation and postal-format research.
42
+
43
+ ## 🧾 Columns (29)
44
+
45
+ `country_code`, `postal_code`, `place_name`, `admin1_name`, `admin1_code`, `admin2_name`, `admin2_code`, `admin3_name`, `admin3_code`, `latitude`, `longitude`, `accuracy`, `country_name`, `country_region`, `country_subregion`, `postal_length`, `is_numeric_postal`, `postal_prefix`, `postal_first_char`, `hemisphere`, `latitude_band`, `longitude_band`, `accuracy_label`, `has_admin2`, `has_admin3`, `admin_depth`, `place_word_count`, `place_name_length`, `geohash`
46
+
47
+ ## 💡 Ideas for using this data
48
+
49
+ 1. **Postal formats** — cluster countries by code length and character mix.
50
+ 2. **Geocoding** — join to any address table on country + postal code; measure match rates.
51
+ 3. **Population proxies** — count codes per admin1 area as a proxy for settlement density.
52
+ 4. **Spatial clustering** — geohash prefixes make it easy to bin codes into map tiles.
53
+ 5. **Prefix hierarchies** — check whether the first one or two characters map cleanly to regions.
54
+ 6. **Data quality** — compare GeoNames accuracy classes across countries.
55
+ 7. **Missing middle** — countries with no admin2 data; what does that imply for address matching?
56
+ 8. **Place-name NLP** — tokenise place names to find common suffixes (ville, stad, burg, -pur).
57
+ 9. **Map visualisation** — plot all coordinates coloured by region (use a sample for speed).
58
+
59
+ ## 📁 Files
60
+
61
+ | File | What it is |
62
+ |---|---|
63
+ | `postal_codes.csv` | 1,835,923 postal records x 29 parameters. |
64
+ | `data_dictionary.csv` | Column / type / description for every field. |
65
+ | `notebook.ipynb` | Starter notebook that loads the CSV and analyses it. |
66
+ | `dataset-metadata.json` | Kaggle API metadata. |
67
+ | `about.md` | Plain-text About block. |
68
+
69
+ ## 🏷️ Tags
70
+
71
+ `postal-codes`, `geography`, `geocoding`, `geonames`, `addresses`, `world`, `tabular`
72
+
73
+ ## 🔗 Provenance
74
+
75
+ - **Source:** **GeoNames** postal code export,
76
+ `https://download.geonames.org/export/zip/allCountries.zip` (creative commons attribution).
77
+ - **Format:** tab-separated, 12 fields per line: country code, postal code, place name, admin1
78
+ name/code, admin2 name/code, admin3 name/code, latitude, longitude, accuracy.
79
+ - **Processing:** exact duplicates removed, country names and World Bank regions joined, bands,
80
+ code-shape fields and geohashes derived.
81
+ - **Snapshot date:** 22 November 2026.
82
+
83
+ ## 🔄 Update frequency
84
+
85
+ **Daily upstream; snapshot here.** GeoNames refreshes the postal export regularly.
86
+
87
+ ## ⚠️ Caveats
88
+
89
+ - Postal code systems differ wildly: some countries have none, others map one code to many places.
90
+ - Coordinates are place centroids, not rooftop locations; accuracy varies by country.
91
+ - GeoNames is community-maintained and coverage is uneven outside Europe and North America.
92
+ - Duplicate removal is on country + code + place + admin1, so genuinely repeated codes remain.
93
+ - Codes are formatted as nationally used; no normalisation (spaces, hyphens) is applied.
94
+ - Row order follows the upstream file (country, then code), not any ranking.
95
+ - This file is large; notebook cells should sample or filter before plotting.
96
+
97
+ ## 📜 Licence
98
+
99
+ GeoNames data is licensed CC BY 4.0 — attribution to GeoNames is required.
100
+
101
+ ### 📋 Column Definitions & File Header
102
+
103
+ | # | Column Name | Data Type | Description |
104
+ |---|---|---|---|
105
+ | 1 | `country_code` | `string` | ISO 3166-1 alpha-2 country code. |
106
+ | 2 | `postal_code` | `string` | Postal code as used nationally (may contain letters, spaces or hyphens). |
107
+ | 3 | `place_name` | `string` | Primary place name for the code. |
108
+ | 4 | `admin1_name` | `string` | First-level administrative division (state, region, province). |
109
+ | 5 | `admin1_code` | `number` | GeoNames code for the first-level division. |
110
+ | 6 | `admin2_name` | `string` | Second-level division (county, district). |
111
+ | 7 | `admin2_code` | `number` | GeoNames code for the second-level division. |
112
+ | 8 | `admin3_name` | `string` | Third-level division (municipality, commune). |
113
+ | 9 | `admin3_code` | `number` | GeoNames code for the third-level division. |
114
+ | 10 | `latitude` | `number` | Latitude of the place centroid (decimal degrees). |
115
+ | 11 | `longitude` | `number` | Longitude of the place centroid (decimal degrees). |
116
+ | 12 | `accuracy` | `number` | GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid. |
117
+ | 13 | `country_name` | `string` | Country common name. |
118
+ | 14 | `country_region` | `number` | World Bank region. |
119
+ | 15 | `country_subregion` | `number` | World Bank subregion. |
120
+ | 16 | `postal_length` | `number` | Number of characters in the postal code. |
121
+ | 17 | `is_numeric_postal` | `boolean` | true when the code contains only digits. |
122
+ | 18 | `postal_prefix` | `string` | First two characters of the postal code (sorting/region prefix). |
123
+ | 19 | `postal_first_char` | `string` | First character of the postal code. |
124
+ | 20 | `hemisphere` | `string` | N/S + E/W hemisphere pair. |
125
+ | 21 | `latitude_band` | `string` | 10-degree latitude band. |
126
+ | 22 | `longitude_band` | `string` | 15-degree longitude band. |
127
+ | 23 | `accuracy_label` | `string` | Human-readable accuracy class. |
128
+ | 24 | `has_admin2` | `boolean` | true when a second-level division is recorded. |
129
+ | 25 | `has_admin3` | `boolean` | true when a third-level division is recorded. |
130
+ | 26 | `admin_depth` | `number` | Number of administrative levels present (1-3 plus country). |
131
+ | 27 | `place_word_count` | `number` | Words in the place name. |
132
+ | 28 | `place_name_length` | `number` | Characters in the place name. |
133
+ | 29 | `geohash` | `string` | 9-character geohash of the coordinates (spatial joins, binning). |
134
+
135
+
136
+
137
+ ---
138
+
139
+ ## 🌟 Support & Community
140
+ If you find this dataset valuable for your research, machine learning projects, or data explorations, **please give it an upvote (👍) on Kaggle!**
141
+ Feedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.
about.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ World Postal Code Directory
2
+
3
+ ### Postal codes as a geographic index
4
+
5
+ GeoNames' `allCountries` postal code export is one of the few open, global postal-code lists.
6
+ This dataset contains **1,835,923 postal-code records in 124 countries**, with **29 parameters**
7
+ per record and duplicates removed on country + code + place + admin1.
8
+
9
+ - **Address hierarchy** — country, postal code, place name, admin1/admin2/admin3 names and codes,
10
+ plus an `admin_depth` count.
11
+ - **Geography** — latitude/longitude, hemisphere, 10-degree latitude band, 15-degree longitude band and
12
+ a 9-character geohash.
13
+ - **Code shape** — length, numeric flag, two-character prefix, first character.
14
+ - **Quality** — GeoNames accuracy code and label, plus admin2/admin3 presence flags.
15
+ - **Country context** — country name, World Bank region and subregion.
16
+
17
+ **1,128,319 codes are purely numeric**, while the rest use letters or mixed formats. The
18
+ file supports geocoding, delivery-zone analysis, regional segmentation and postal-format research.
19
+
20
+ 29 columns; 1,835,923 postal records x 29 parameters.
data_dictionary.csv ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ column,data_type,description
2
+ country_code,string,ISO 3166-1 alpha-2 country code.
3
+ postal_code,string,"Postal code as used nationally (may contain letters, spaces or hyphens)."
4
+ place_name,string,Primary place name for the code.
5
+ admin1_name,string,"First-level administrative division (state, region, province)."
6
+ admin1_code,number,GeoNames code for the first-level division.
7
+ admin2_name,string,"Second-level division (county, district)."
8
+ admin2_code,number,GeoNames code for the second-level division.
9
+ admin3_name,string,"Third-level division (municipality, commune)."
10
+ admin3_code,number,GeoNames code for the third-level division.
11
+ latitude,number,Latitude of the place centroid (decimal degrees).
12
+ longitude,number,Longitude of the place centroid (decimal degrees).
13
+ accuracy,number,"GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid."
14
+ country_name,string,Country common name.
15
+ country_region,number,World Bank region.
16
+ country_subregion,number,World Bank subregion.
17
+ postal_length,number,Number of characters in the postal code.
18
+ is_numeric_postal,boolean,true when the code contains only digits.
19
+ postal_prefix,string,First two characters of the postal code (sorting/region prefix).
20
+ postal_first_char,string,First character of the postal code.
21
+ hemisphere,string,N/S + E/W hemisphere pair.
22
+ latitude_band,string,10-degree latitude band.
23
+ longitude_band,string,15-degree longitude band.
24
+ accuracy_label,string,Human-readable accuracy class.
25
+ has_admin2,boolean,true when a second-level division is recorded.
26
+ has_admin3,boolean,true when a third-level division is recorded.
27
+ admin_depth,number,Number of administrative levels present (1-3 plus country).
28
+ place_word_count,number,Words in the place name.
29
+ place_name_length,number,Characters in the place name.
30
+ geohash,string,"9-character geohash of the coordinates (spatial joins, binning)."
dataset-metadata.json ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "World Postal Code Directory",
3
+ "id": "edudev-commons-org/world-postal-codes",
4
+ "subtitle": "1,835,923 postal codes in 124 countries with coordinates & hierarchy",
5
+ "description": "# World Postal Code Directory\n\n**Subtitle:** 1,835,923 postal codes in 124 countries with coordinates & hierarchy\n\n**Tags:** `tabular`, `geography`, `world`\n\n**Dataset File:** `postal_codes.csv` (1,835,923 rows, 29 columns, 271.3 MB)\n\n**Provenance & Source:** GeoNames Postal Code Database (geonames.org)\n\n**Expected Update Frequency:** `annually`\n\n---\n\n## \ud83d\udcd6 Description\n\n### Postal codes as a geographic index\n\nGeoNames' `allCountries` postal code export is one of the few open, global postal-code lists.\nThis dataset contains **1,835,923 postal-code records in 124 countries**, with **29 parameters**\nper record and duplicates removed on country + code + place + admin1.\n\n- **Address hierarchy** \u2014 country, postal code, place name, admin1/admin2/admin3 names and codes,\n plus an `admin_depth` count.\n- **Geography** \u2014 latitude/longitude, hemisphere, 10-degree latitude band, 15-degree longitude band and\n a 9-character geohash.\n- **Code shape** \u2014 length, numeric flag, two-character prefix, first character.\n- **Quality** \u2014 GeoNames accuracy code and label, plus admin2/admin3 presence flags.\n- **Country context** \u2014 country name, World Bank region and subregion.\n\n**1,128,319 codes are purely numeric**, while the rest use letters or mixed formats. The\nfile supports geocoding, delivery-zone analysis, regional segmentation and postal-format research.\n\n## \ud83e\uddfe Columns (29)\n\n`country_code`, `postal_code`, `place_name`, `admin1_name`, `admin1_code`, `admin2_name`, `admin2_code`, `admin3_name`, `admin3_code`, `latitude`, `longitude`, `accuracy`, `country_name`, `country_region`, `country_subregion`, `postal_length`, `is_numeric_postal`, `postal_prefix`, `postal_first_char`, `hemisphere`, `latitude_band`, `longitude_band`, `accuracy_label`, `has_admin2`, `has_admin3`, `admin_depth`, `place_word_count`, `place_name_length`, `geohash`\n\n## \ud83d\udca1 Ideas for using this data\n\n1. **Postal formats** \u2014 cluster countries by code length and character mix.\n2. **Geocoding** \u2014 join to any address table on country + postal code; measure match rates.\n3. **Population proxies** \u2014 count codes per admin1 area as a proxy for settlement density.\n4. **Spatial clustering** \u2014 geohash prefixes make it easy to bin codes into map tiles.\n5. **Prefix hierarchies** \u2014 check whether the first one or two characters map cleanly to regions.\n6. **Data quality** \u2014 compare GeoNames accuracy classes across countries.\n7. **Missing middle** \u2014 countries with no admin2 data; what does that imply for address matching?\n8. **Place-name NLP** \u2014 tokenise place names to find common suffixes (ville, stad, burg, -pur).\n9. **Map visualisation** \u2014 plot all coordinates coloured by region (use a sample for speed).\n\n## \ud83d\udcc1 Files\n\n| File | What it is |\n|---|---|\n| `postal_codes.csv` | 1,835,923 postal records x 29 parameters. |\n| `data_dictionary.csv` | Column / type / description for every field. |\n| `notebook.ipynb` | Starter notebook that loads the CSV and analyses it. |\n| `dataset-metadata.json` | Kaggle API metadata. |\n| `about.md` | Plain-text About block. |\n\n## \ud83c\udff7\ufe0f Tags\n\n`postal-codes`, `geography`, `geocoding`, `geonames`, `addresses`, `world`, `tabular`\n\n## \ud83d\udd17 Provenance\n\n- **Source:** **GeoNames** postal code export,\n `https://download.geonames.org/export/zip/allCountries.zip` (creative commons attribution).\n- **Format:** tab-separated, 12 fields per line: country code, postal code, place name, admin1\n name/code, admin2 name/code, admin3 name/code, latitude, longitude, accuracy.\n- **Processing:** exact duplicates removed, country names and World Bank regions joined, bands,\n code-shape fields and geohashes derived.\n- **Snapshot date:** 22 November 2026.\n\n## \ud83d\udd04 Update frequency\n\n**Daily upstream; snapshot here.** GeoNames refreshes the postal export regularly.\n\n## \u26a0\ufe0f Caveats\n\n- Postal code systems differ wildly: some countries have none, others map one code to many places.\n- Coordinates are place centroids, not rooftop locations; accuracy varies by country.\n- GeoNames is community-maintained and coverage is uneven outside Europe and North America.\n- Duplicate removal is on country + code + place + admin1, so genuinely repeated codes remain.\n- Codes are formatted as nationally used; no normalisation (spaces, hyphens) is applied.\n- Row order follows the upstream file (country, then code), not any ranking.\n- This file is large; notebook cells should sample or filter before plotting.\n\n## \ud83d\udcdc Licence\n\nGeoNames data is licensed CC BY 4.0 \u2014 attribution to GeoNames is required.\n\n### \ud83d\udccb Column Definitions & File Header\n\n| # | Column Name | Data Type | Description |\n|---|---|---|---|\n| 1 | `country_code` | `string` | ISO 3166-1 alpha-2 country code. |\n| 2 | `postal_code` | `string` | Postal code as used nationally (may contain letters, spaces or hyphens). |\n| 3 | `place_name` | `string` | Primary place name for the code. |\n| 4 | `admin1_name` | `string` | First-level administrative division (state, region, province). |\n| 5 | `admin1_code` | `number` | GeoNames code for the first-level division. |\n| 6 | `admin2_name` | `string` | Second-level division (county, district). |\n| 7 | `admin2_code` | `number` | GeoNames code for the second-level division. |\n| 8 | `admin3_name` | `string` | Third-level division (municipality, commune). |\n| 9 | `admin3_code` | `number` | GeoNames code for the third-level division. |\n| 10 | `latitude` | `number` | Latitude of the place centroid (decimal degrees). |\n| 11 | `longitude` | `number` | Longitude of the place centroid (decimal degrees). |\n| 12 | `accuracy` | `number` | GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid. |\n| 13 | `country_name` | `string` | Country common name. |\n| 14 | `country_region` | `number` | World Bank region. |\n| 15 | `country_subregion` | `number` | World Bank subregion. |\n| 16 | `postal_length` | `number` | Number of characters in the postal code. |\n| 17 | `is_numeric_postal` | `boolean` | true when the code contains only digits. |\n| 18 | `postal_prefix` | `string` | First two characters of the postal code (sorting/region prefix). |\n| 19 | `postal_first_char` | `string` | First character of the postal code. |\n| 20 | `hemisphere` | `string` | N/S + E/W hemisphere pair. |\n| 21 | `latitude_band` | `string` | 10-degree latitude band. |\n| 22 | `longitude_band` | `string` | 15-degree longitude band. |\n| 23 | `accuracy_label` | `string` | Human-readable accuracy class. |\n| 24 | `has_admin2` | `boolean` | true when a second-level division is recorded. |\n| 25 | `has_admin3` | `boolean` | true when a third-level division is recorded. |\n| 26 | `admin_depth` | `number` | Number of administrative levels present (1-3 plus country). |\n| 27 | `place_word_count` | `number` | Words in the place name. |\n| 28 | `place_name_length` | `number` | Characters in the place name. |\n| 29 | `geohash` | `string` | 9-character geohash of the coordinates (spatial joins, binning). |\n\n\n\n---\n\n## \ud83c\udf1f Support & Community\nIf you find this dataset valuable for your research, machine learning projects, or data explorations, **please give it an upvote (\ud83d\udc4d) on Kaggle!**\nFeedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.\n",
6
+ "isPrivate": false,
7
+ "licenses": [
8
+ {
9
+ "name": "CC-BY-4.0"
10
+ }
11
+ ],
12
+ "keywords": [
13
+ "tabular",
14
+ "geography",
15
+ "world"
16
+ ],
17
+ "resources": [
18
+ {
19
+ "path": "postal_codes.csv",
20
+ "description": "Primary dataset file containing 1,835,923 records across 29 parameters.",
21
+ "schema": {
22
+ "fields": [
23
+ {
24
+ "name": "country_code",
25
+ "type": "string",
26
+ "description": "ISO 3166-1 alpha-2 country code."
27
+ },
28
+ {
29
+ "name": "postal_code",
30
+ "type": "string",
31
+ "description": "Postal code as used nationally (may contain letters, spaces or hyphens)."
32
+ },
33
+ {
34
+ "name": "place_name",
35
+ "type": "string",
36
+ "description": "Primary place name for the code."
37
+ },
38
+ {
39
+ "name": "admin1_name",
40
+ "type": "string",
41
+ "description": "First-level administrative division (state, region, province)."
42
+ },
43
+ {
44
+ "name": "admin1_code",
45
+ "type": "number",
46
+ "description": "GeoNames code for the first-level division."
47
+ },
48
+ {
49
+ "name": "admin2_name",
50
+ "type": "string",
51
+ "description": "Second-level division (county, district)."
52
+ },
53
+ {
54
+ "name": "admin2_code",
55
+ "type": "number",
56
+ "description": "GeoNames code for the second-level division."
57
+ },
58
+ {
59
+ "name": "admin3_name",
60
+ "type": "string",
61
+ "description": "Third-level division (municipality, commune)."
62
+ },
63
+ {
64
+ "name": "admin3_code",
65
+ "type": "number",
66
+ "description": "GeoNames code for the third-level division."
67
+ },
68
+ {
69
+ "name": "latitude",
70
+ "type": "number",
71
+ "description": "Latitude of the place centroid (decimal degrees)."
72
+ },
73
+ {
74
+ "name": "longitude",
75
+ "type": "number",
76
+ "description": "Longitude of the place centroid (decimal degrees)."
77
+ },
78
+ {
79
+ "name": "accuracy",
80
+ "type": "number",
81
+ "description": "GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid."
82
+ },
83
+ {
84
+ "name": "country_name",
85
+ "type": "string",
86
+ "description": "Country common name."
87
+ },
88
+ {
89
+ "name": "country_region",
90
+ "type": "number",
91
+ "description": "World Bank region."
92
+ },
93
+ {
94
+ "name": "country_subregion",
95
+ "type": "number",
96
+ "description": "World Bank subregion."
97
+ },
98
+ {
99
+ "name": "postal_length",
100
+ "type": "number",
101
+ "description": "Number of characters in the postal code."
102
+ },
103
+ {
104
+ "name": "is_numeric_postal",
105
+ "type": "boolean",
106
+ "description": "true when the code contains only digits."
107
+ },
108
+ {
109
+ "name": "postal_prefix",
110
+ "type": "string",
111
+ "description": "First two characters of the postal code (sorting/region prefix)."
112
+ },
113
+ {
114
+ "name": "postal_first_char",
115
+ "type": "string",
116
+ "description": "First character of the postal code."
117
+ },
118
+ {
119
+ "name": "hemisphere",
120
+ "type": "string",
121
+ "description": "N/S + E/W hemisphere pair."
122
+ },
123
+ {
124
+ "name": "latitude_band",
125
+ "type": "string",
126
+ "description": "10-degree latitude band."
127
+ },
128
+ {
129
+ "name": "longitude_band",
130
+ "type": "string",
131
+ "description": "15-degree longitude band."
132
+ },
133
+ {
134
+ "name": "accuracy_label",
135
+ "type": "string",
136
+ "description": "Human-readable accuracy class."
137
+ },
138
+ {
139
+ "name": "has_admin2",
140
+ "type": "boolean",
141
+ "description": "true when a second-level division is recorded."
142
+ },
143
+ {
144
+ "name": "has_admin3",
145
+ "type": "boolean",
146
+ "description": "true when a third-level division is recorded."
147
+ },
148
+ {
149
+ "name": "admin_depth",
150
+ "type": "number",
151
+ "description": "Number of administrative levels present (1-3 plus country)."
152
+ },
153
+ {
154
+ "name": "place_word_count",
155
+ "type": "number",
156
+ "description": "Words in the place name."
157
+ },
158
+ {
159
+ "name": "place_name_length",
160
+ "type": "number",
161
+ "description": "Characters in the place name."
162
+ },
163
+ {
164
+ "name": "geohash",
165
+ "type": "string",
166
+ "description": "9-character geohash of the coordinates (spatial joins, binning)."
167
+ }
168
+ ]
169
+ }
170
+ },
171
+ {
172
+ "path": "data_dictionary.csv",
173
+ "description": "Field-level data dictionary detailing column names, data types, and semantic definitions."
174
+ },
175
+ {
176
+ "path": "notebook.ipynb",
177
+ "description": "Jupyter starter notebook providing exploratory data analysis and baseline visualizations."
178
+ }
179
+ ]
180
+ }
kernel-metadata.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "samyakrajbayar/world-postal-codes-analysis",
3
+ "title": "World Postal Code Directory Analysis",
4
+ "code_file": "notebook.ipynb",
5
+ "language": "python",
6
+ "kernel_type": "notebook",
7
+ "is_private": false,
8
+ "enable_gpu": false,
9
+ "enable_tpu": false,
10
+ "enable_internet": true,
11
+ "dataset_sources": [
12
+ "edudev-commons-org/world-postal-codes"
13
+ ]
14
+ }
notebook.ipynb ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "6d46bcd2",
6
+ "metadata": {},
7
+ "source": [
8
+ "# World Postal Code Directory\n",
9
+ "\n",
10
+ "Starter notebook for the Kaggle dataset in this folder. It loads `postal_codes.csv` with pandas and walks through quality checks and a first piece of analysis.\n",
11
+ "\n",
12
+ "**Files:** `postal_codes.csv`, `data_dictionary.csv`."
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "markdown",
17
+ "id": "0000f7f2",
18
+ "metadata": {},
19
+ "source": [
20
+ "## 1. Load the data"
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "id": "5874fd30",
26
+ "metadata": {},
27
+ "execution_count": null,
28
+ "outputs": [],
29
+ "source": [
30
+ "import pandas as pd\n",
31
+ "\n",
32
+ "df = pd.read_csv(\"postal_codes.csv\", dtype={\"postal_code\": str}, low_memory=False)\n",
33
+ "print(df.shape)"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "markdown",
38
+ "id": "325de123",
39
+ "metadata": {},
40
+ "source": [
41
+ "## 2. Shape, types and missing values"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "code",
46
+ "id": "6eb42bc8",
47
+ "metadata": {},
48
+ "execution_count": null,
49
+ "outputs": [],
50
+ "source": [
51
+ "print(f\"{df.shape[0]:,} rows x {df.shape[1]} columns\")\n",
52
+ "\n",
53
+ "missing = df.isna().mean().mul(100).sort_values(ascending=False)\n",
54
+ "missing[missing > 0].round(1).to_frame(\"missing_%\").head(15)"
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "markdown",
59
+ "id": "f2d963fe",
60
+ "metadata": {},
61
+ "source": [
62
+ "## 3. Numeric summary"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "id": "aa2f8fd4",
68
+ "metadata": {},
69
+ "execution_count": null,
70
+ "outputs": [],
71
+ "source": [
72
+ "df.describe(include='number').T.round(2).head(20)"
73
+ ]
74
+ },
75
+ {
76
+ "cell_type": "markdown",
77
+ "id": "b96932fe",
78
+ "metadata": {},
79
+ "source": [
80
+ "## 4. Records by country"
81
+ ]
82
+ },
83
+ {
84
+ "cell_type": "code",
85
+ "id": "d1fcce62",
86
+ "metadata": {},
87
+ "execution_count": null,
88
+ "outputs": [],
89
+ "source": [
90
+ "df[\"country_name\"].value_counts().head(15).to_frame(\"postal_records\")"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "markdown",
95
+ "id": "dc07af50",
96
+ "metadata": {},
97
+ "source": [
98
+ "## 5. Postal code length distribution"
99
+ ]
100
+ },
101
+ {
102
+ "cell_type": "code",
103
+ "id": "b958164f",
104
+ "metadata": {},
105
+ "execution_count": null,
106
+ "outputs": [],
107
+ "source": [
108
+ "df[\"postal_length\"].value_counts().sort_index().head(12).to_frame(\"codes\")"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "markdown",
113
+ "id": "eefadcb2",
114
+ "metadata": {},
115
+ "source": [
116
+ "## 6. Numeric vs alphanumeric"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "id": "63659e72",
122
+ "metadata": {},
123
+ "execution_count": null,
124
+ "outputs": [],
125
+ "source": [
126
+ "df[\"is_numeric_postal\"].value_counts(normalize=True).mul(100).round(1)"
127
+ ]
128
+ },
129
+ {
130
+ "cell_type": "markdown",
131
+ "id": "9df55b32",
132
+ "metadata": {},
133
+ "source": [
134
+ "## 7. Administrative depth"
135
+ ]
136
+ },
137
+ {
138
+ "cell_type": "code",
139
+ "id": "3d04fe21",
140
+ "metadata": {},
141
+ "execution_count": null,
142
+ "outputs": [],
143
+ "source": [
144
+ "df[\"admin_depth\"].value_counts().sort_index().to_frame(\"records\")"
145
+ ]
146
+ },
147
+ {
148
+ "cell_type": "markdown",
149
+ "id": "d11c50d9",
150
+ "metadata": {},
151
+ "source": [
152
+ "## 8. Map sample"
153
+ ]
154
+ },
155
+ {
156
+ "cell_type": "code",
157
+ "id": "7973ff27",
158
+ "metadata": {},
159
+ "execution_count": null,
160
+ "outputs": [],
161
+ "source": [
162
+ "sample = df.dropna(subset=[\"latitude\", \"longitude\"]).sample(5000, random_state=0)\n",
163
+ "sample.plot.scatter(x=\"longitude\", y=\"latitude\", s=1, alpha=0.3, figsize=(11, 6))"
164
+ ]
165
+ },
166
+ {
167
+ "cell_type": "markdown",
168
+ "id": "6e43770c",
169
+ "metadata": {},
170
+ "source": [
171
+ "## Next steps\n",
172
+ "\n",
173
+ "See `KAGGLE.md` for analysis ideas, caveats and provenance."
174
+ ]
175
+ }
176
+ ],
177
+ "metadata": {
178
+ "kernelspec": {
179
+ "display_name": "Python 3",
180
+ "language": "python",
181
+ "name": "python3"
182
+ },
183
+ "language_info": {
184
+ "name": "python",
185
+ "version": "3.11",
186
+ "mimetype": "text/x-python",
187
+ "file_extension": ".py",
188
+ "codemirror_mode": {
189
+ "name": "ipython",
190
+ "version": 3
191
+ },
192
+ "pygments_lexer": "ipython3",
193
+ "nbconvert_exporter": "python"
194
+ }
195
+ },
196
+ "nbformat": 4,
197
+ "nbformat_minor": 5
198
+ }
postal_codes.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c9af46fa053bc0a70b394000623a0ee2b43a07379ef7bdd6634d5d6ba5babb5
3
+ size 284530573
postal_codes.csv.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e2d50c72606b03609a56ef428580c2d44fe527f36b76042095a416e66ffff4d
3
+ size 29981051