Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code:   DatasetGenerationCastError
Exception:    DatasetGenerationCastError
Message:      An error occurred while generating the dataset

All the data files must have the same columns, but at some point there are 29 new columns ({'admin3_name', 'postal_prefix', 'longitude_band', 'admin1_code', 'accuracy_label', 'country_name', 'admin_depth', 'hemisphere', 'postal_code', 'latitude_band', 'has_admin2', 'country_subregion', 'postal_first_char', 'place_name_length', 'admin2_name', 'longitude', 'geohash', 'is_numeric_postal', 'latitude', 'admin2_code', 'postal_length', 'accuracy', 'admin1_name', 'country_region', 'has_admin3', 'country_code', 'place_word_count', 'admin3_code', 'place_name'}) and 3 missing columns ({'column', 'data_type', 'description'}).

This happened while the csv dataset builder was generating data using

hf://datasets/EduDevCommons/world-postal-codes/postal_codes.csv (at revision 224d50a9c16e162de05435f3c89d5c2b5a028f3f), ['hf://datasets/EduDevCommons/world-postal-codes@224d50a9c16e162de05435f3c89d5c2b5a028f3f/data_dictionary.csv', 'hf://datasets/EduDevCommons/world-postal-codes@224d50a9c16e162de05435f3c89d5c2b5a028f3f/postal_codes.csv', 'hf://datasets/EduDevCommons/world-postal-codes@224d50a9c16e162de05435f3c89d5c2b5a028f3f/postal_codes.csv.zip']

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1856, in _prepare_split_single
                  writer.write_table(table)
                  ~~~~~~~~~~~~~~~~~~^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 811, in write_table
                  self._write_table(pa_table, writer_batch_size=writer_batch_size)
                  ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 822, in _write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2394, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2322, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              country_code: string
              postal_code: string
              place_name: string
              admin1_name: string
              admin1_code: int64
              admin2_name: double
              admin2_code: double
              admin3_name: string
              admin3_code: double
              latitude: double
              longitude: double
              accuracy: int64
              country_name: double
              country_region: double
              country_subregion: double
              postal_length: int64
              is_numeric_postal: bool
              postal_prefix: string
              postal_first_char: string
              hemisphere: string
              latitude_band: string
              longitude_band: string
              accuracy_label: string
              has_admin2: bool
              has_admin3: bool
              admin_depth: int64
              place_word_count: int64
              place_name_length: int64
              geohash: string
              -- schema metadata --
              pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 3854
              to
              {'column': Value('string'), 'data_type': Value('string'), 'description': Value('string')}
              because column names don't match
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1379, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 956, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1702, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1858, in _prepare_split_single
                  raise DatasetGenerationCastError.from_cast_error(
                  ...<4 lines>...
                  )
              datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
              
              All the data files must have the same columns, but at some point there are 29 new columns ({'admin3_name', 'postal_prefix', 'longitude_band', 'admin1_code', 'accuracy_label', 'country_name', 'admin_depth', 'hemisphere', 'postal_code', 'latitude_band', 'has_admin2', 'country_subregion', 'postal_first_char', 'place_name_length', 'admin2_name', 'longitude', 'geohash', 'is_numeric_postal', 'latitude', 'admin2_code', 'postal_length', 'accuracy', 'admin1_name', 'country_region', 'has_admin3', 'country_code', 'place_word_count', 'admin3_code', 'place_name'}) and 3 missing columns ({'column', 'data_type', 'description'}).
              
              This happened while the csv dataset builder was generating data using
              
              hf://datasets/EduDevCommons/world-postal-codes/postal_codes.csv (at revision 224d50a9c16e162de05435f3c89d5c2b5a028f3f), ['hf://datasets/EduDevCommons/world-postal-codes@224d50a9c16e162de05435f3c89d5c2b5a028f3f/data_dictionary.csv', 'hf://datasets/EduDevCommons/world-postal-codes@224d50a9c16e162de05435f3c89d5c2b5a028f3f/postal_codes.csv', 'hf://datasets/EduDevCommons/world-postal-codes@224d50a9c16e162de05435f3c89d5c2b5a028f3f/postal_codes.csv.zip']
              
              Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

column
string
data_type
string
description
string
country_code
string
ISO 3166-1 alpha-2 country code.
postal_code
string
Postal code as used nationally (may contain letters, spaces or hyphens).
place_name
string
Primary place name for the code.
admin1_name
string
First-level administrative division (state, region, province).
admin1_code
number
GeoNames code for the first-level division.
admin2_name
string
Second-level division (county, district).
admin2_code
number
GeoNames code for the second-level division.
admin3_name
string
Third-level division (municipality, commune).
admin3_code
number
GeoNames code for the third-level division.
latitude
number
Latitude of the place centroid (decimal degrees).
longitude
number
Longitude of the place centroid (decimal degrees).
accuracy
number
GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid.
country_name
string
Country common name.
country_region
number
World Bank region.
country_subregion
number
World Bank subregion.
postal_length
number
Number of characters in the postal code.
is_numeric_postal
boolean
true when the code contains only digits.
postal_prefix
string
First two characters of the postal code (sorting/region prefix).
postal_first_char
string
First character of the postal code.
hemisphere
string
N/S + E/W hemisphere pair.
latitude_band
string
10-degree latitude band.
longitude_band
string
15-degree longitude band.
accuracy_label
string
Human-readable accuracy class.
has_admin2
boolean
true when a second-level division is recorded.
has_admin3
boolean
true when a third-level division is recorded.
admin_depth
number
Number of administrative levels present (1-3 plus country).
place_word_count
number
Words in the place name.
place_name_length
number
Characters in the place name.
geohash
string
9-character geohash of the coordinates (spatial joins, binning).
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
End of preview.

YAML Metadata Warning:The task_categories "tabular" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

World Postal Code Directory

Subtitle: 1,835,923 postal codes in 124 countries with coordinates & hierarchy

Tags: tabular, geography, world

Dataset File: postal_codes.csv (1,835,923 rows, 29 columns, 271.3 MB)

Provenance & Source: GeoNames Postal Code Database (geonames.org)

Expected Update Frequency: annually


πŸ“– Description

Postal codes as a geographic index

GeoNames' allCountries postal code export is one of the few open, global postal-code lists. This dataset contains 1,835,923 postal-code records in 124 countries, with 29 parameters per record and duplicates removed on country + code + place + admin1.

  • Address hierarchy β€” country, postal code, place name, admin1/admin2/admin3 names and codes, plus an admin_depth count.
  • Geography β€” latitude/longitude, hemisphere, 10-degree latitude band, 15-degree longitude band and a 9-character geohash.
  • Code shape β€” length, numeric flag, two-character prefix, first character.
  • Quality β€” GeoNames accuracy code and label, plus admin2/admin3 presence flags.
  • Country context β€” country name, World Bank region and subregion.

1,128,319 codes are purely numeric, while the rest use letters or mixed formats. The file supports geocoding, delivery-zone analysis, regional segmentation and postal-format research.

🧾 Columns (29)

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

πŸ’‘ Ideas for using this data

  1. Postal formats β€” cluster countries by code length and character mix.
  2. Geocoding β€” join to any address table on country + postal code; measure match rates.
  3. Population proxies β€” count codes per admin1 area as a proxy for settlement density.
  4. Spatial clustering β€” geohash prefixes make it easy to bin codes into map tiles.
  5. Prefix hierarchies β€” check whether the first one or two characters map cleanly to regions.
  6. Data quality β€” compare GeoNames accuracy classes across countries.
  7. Missing middle β€” countries with no admin2 data; what does that imply for address matching?
  8. Place-name NLP β€” tokenise place names to find common suffixes (ville, stad, burg, -pur).
  9. Map visualisation β€” plot all coordinates coloured by region (use a sample for speed).

πŸ“ Files

File What it is
postal_codes.csv 1,835,923 postal records x 29 parameters.
data_dictionary.csv Column / type / description for every field.
notebook.ipynb Starter notebook that loads the CSV and analyses it.
dataset-metadata.json Kaggle API metadata.
about.md Plain-text About block.

🏷️ Tags

postal-codes, geography, geocoding, geonames, addresses, world, tabular

πŸ”— Provenance

  • Source: GeoNames postal code export, https://download.geonames.org/export/zip/allCountries.zip (creative commons attribution).
  • Format: tab-separated, 12 fields per line: country code, postal code, place name, admin1 name/code, admin2 name/code, admin3 name/code, latitude, longitude, accuracy.
  • Processing: exact duplicates removed, country names and World Bank regions joined, bands, code-shape fields and geohashes derived.
  • Snapshot date: 22 November 2026.

πŸ”„ Update frequency

Daily upstream; snapshot here. GeoNames refreshes the postal export regularly.

⚠️ Caveats

  • Postal code systems differ wildly: some countries have none, others map one code to many places.
  • Coordinates are place centroids, not rooftop locations; accuracy varies by country.
  • GeoNames is community-maintained and coverage is uneven outside Europe and North America.
  • Duplicate removal is on country + code + place + admin1, so genuinely repeated codes remain.
  • Codes are formatted as nationally used; no normalisation (spaces, hyphens) is applied.
  • Row order follows the upstream file (country, then code), not any ranking.
  • This file is large; notebook cells should sample or filter before plotting.

πŸ“œ Licence

GeoNames data is licensed CC BY 4.0 β€” attribution to GeoNames is required.

πŸ“‹ Column Definitions & File Header

# Column Name Data Type Description
1 country_code string ISO 3166-1 alpha-2 country code.
2 postal_code string Postal code as used nationally (may contain letters, spaces or hyphens).
3 place_name string Primary place name for the code.
4 admin1_name string First-level administrative division (state, region, province).
5 admin1_code number GeoNames code for the first-level division.
6 admin2_name string Second-level division (county, district).
7 admin2_code number GeoNames code for the second-level division.
8 admin3_name string Third-level division (municipality, commune).
9 admin3_code number GeoNames code for the third-level division.
10 latitude number Latitude of the place centroid (decimal degrees).
11 longitude number Longitude of the place centroid (decimal degrees).
12 accuracy number GeoNames accuracy code: 1 estimated, 4 region/state, 6 admin2 centroid.
13 country_name string Country common name.
14 country_region number World Bank region.
15 country_subregion number World Bank subregion.
16 postal_length number Number of characters in the postal code.
17 is_numeric_postal boolean true when the code contains only digits.
18 postal_prefix string First two characters of the postal code (sorting/region prefix).
19 postal_first_char string First character of the postal code.
20 hemisphere string N/S + E/W hemisphere pair.
21 latitude_band string 10-degree latitude band.
22 longitude_band string 15-degree longitude band.
23 accuracy_label string Human-readable accuracy class.
24 has_admin2 boolean true when a second-level division is recorded.
25 has_admin3 boolean true when a third-level division is recorded.
26 admin_depth number Number of administrative levels present (1-3 plus country).
27 place_word_count number Words in the place name.
28 place_name_length number Characters in the place name.
29 geohash string 9-character geohash of the coordinates (spatial joins, binning).

🌟 Support & Community

If you find this dataset valuable for your research, machine learning projects, or data explorations, please give it an upvote (πŸ‘) on Kaggle! Feedback, questions, and community notebook submissions are warmly welcomed in the Discussions tab.

Downloads last month
23