Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    CastError
Message:      Couldn't cast
id: string
title: string
code_file: string
language: string
kernel_type: string
is_private: bool
enable_gpu: bool
enable_tpu: bool
enable_internet: bool
dataset_sources: list<item: string>
  child 0, item: string
resources: list<item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name:  (... 46 chars omitted)
  child 0, item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name: string, typ (... 34 chars omitted)
      child 0, path: string
      child 1, description: string
      child 2, schema: struct<fields: list<item: struct<name: string, type: string, description: string>>>
          child 0, fields: list<item: struct<name: string, type: string, description: string>>
              child 0, item: struct<name: string, type: string, description: string>
                  child 0, name: string
                  child 1, type: string
                  child 2, description: string
isPrivate: bool
subtitle: string
licenses: list<item: struct<name: string>>
  child 0, item: struct<name: string>
      child 0, name: string
keywords: list<item: string>
  child 0, item: string
description: string
to
{'title': Value('string'), 'id': Value('string'), 'subtitle': Value('string'), 'description': Value('string'), 'isPrivate': Value('bool'), 'licenses': List({'name': Value('string')}), 'keywords': List(Value('string')), 'resources': List({'path': Value('string'), 'description': Value('string'), 'schema': {'fields': List({'name': Value('string'), 'type': Value('string'), 'description': Value('string')})}})}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 274, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 544, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 3074, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2578, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2603, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 577, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 459, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 373, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_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
              id: string
              title: string
              code_file: string
              language: string
              kernel_type: string
              is_private: bool
              enable_gpu: bool
              enable_tpu: bool
              enable_internet: bool
              dataset_sources: list<item: string>
                child 0, item: string
              resources: list<item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name:  (... 46 chars omitted)
                child 0, item: struct<path: string, description: string, schema: struct<fields: list<item: struct<name: string, typ (... 34 chars omitted)
                    child 0, path: string
                    child 1, description: string
                    child 2, schema: struct<fields: list<item: struct<name: string, type: string, description: string>>>
                        child 0, fields: list<item: struct<name: string, type: string, description: string>>
                            child 0, item: struct<name: string, type: string, description: string>
                                child 0, name: string
                                child 1, type: string
                                child 2, description: string
              isPrivate: bool
              subtitle: string
              licenses: list<item: struct<name: string>>
                child 0, item: struct<name: string>
                    child 0, name: string
              keywords: list<item: string>
                child 0, item: string
              description: string
              to
              {'title': Value('string'), 'id': Value('string'), 'subtitle': Value('string'), 'description': Value('string'), 'isPrivate': Value('bool'), 'licenses': List({'name': Value('string')}), 'keywords': List(Value('string')), 'resources': List({'path': Value('string'), 'description': Value('string'), 'schema': {'fields': List({'name': Value('string'), 'type': Value('string'), 'description': Value('string')})}})}
              because column names don't match

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.

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 Cities Gazetteer

Subtitle: 34,248 cities above 15,000 people with admin divisions and national statistics

Tags: cities, urbanization, geography, population, geospatial, demography, world, geonames, tabular, clustering

Dataset File: cities.csv (34,248 rows, 43 columns, 14.6 MB)


πŸ“– Description

Every city on Earth with more than 15,000 people

A gazetteer of 34,248 cities in 244 countries and territories, exported from GeoNames and enriched with national statistics, administrative names and derived urban features β€” 43 parameters per city.

Each row gives:

  • Identity β€” GeoNames id, name, ASCII name, full alternative-name list, feature class and feature code.
  • Location β€” latitude and longitude, elevation from records and from a digital elevation model, IANA time zone and the last modification date.
  • Administration β€” ISO country code, alternate country codes for border towns, and the codes and resolved name for the first-level administrative division, plus second-, third- and fourth-level codes.
  • Status β€” whether the city is the national capital (241 capitals), a first-level administrative capital, or an ordinary populated place.
  • Population β€” city population, a population band, the city's share of its country's population and its rank within that country.
  • National context β€” country name, continent, UN region and sub-region, total population, area, population density, urbanisation rate and GDP per capita.
  • Geometry and language β€” hemisphere, latitude band, elevation band, distance to the capital, alternative-name count, name length and a diacritics flag.

The alternative-name count is a surprisingly good proxy for international prominence, and the capital-distance column lets you measure how primate a country's urban system is.

🧾 Columns (43)

geonameid, name, asciiname, alternatenames, latitude, longitude, feature_class, feature_code, country_code, cc2, admin1_code, admin2_code, admin3_code, admin4_code, population, elevation_m, dem_m, timezone, modification_date, country_name, continent, region, subregion, admin1_name, is_capital, is_admin_capital, hemisphere, latitude_band, population_class, population_share_country_pct, country_urban_pct, country_population, country_area_km2, country_pop_density_per_km2, city_rank_in_country, alt_names_count, name_length, has_diacritics, distance_to_capital_km, timezone_region, utc_offset_hours, elevation_band, gdp_per_capita_usd

πŸ’‘ Ideas for using this data

  1. Urban hierarchy β€” Zipf's law: rank versus population within each country.
  2. Primacy β€” share of the largest city in national population, and how far the second city lags.
  3. Megacity map β€” plot all cities over 5 million with a population-weighted scatter.
  4. Coastal vs inland β€” with elevation and distance-to-capital, classify settlement patterns.
  5. Name linguistics β€” diacritics, name length and alternative-name counts by region.
  6. Capital effect β€” does distance to the capital predict a city's population rank?
  7. Country clustering β€” build an urban profile per country (mean city size, primacy, density) and cluster.
  8. Geospatial β€” DBSCAN/HDBSCAN over coordinates to recover metropolitan agglomerations that GeoNames lists as separate cities.
  9. Regression β€” predict city population from country and geography features.

πŸ“ Files

File What it is
cities.csv 34,248 cities x 43 parameters.
data_dictionary.csv Column / type / description for every field.
notebook.ipynb Starter notebook: Zipf's law, primacy, megacity map.
dataset-metadata.json Kaggle API metadata.
about.md Plain-text About block.

🏷️ Tags

cities, urbanization, geography, population, geospatial, demography, world, geonames, tabular, clustering

πŸ”— Provenance

  • Primary source: GeoNames cities15000.zip β€” all populated places with a population above 15,000 (or capitals), download.geonames.org/export/dump/.
  • Administrative names: GeoNames admin1CodesASCII.txt, joined on country_code.admin1_code.
  • Enrichment: country name, continent, UN region/sub-region, population, area, urbanisation rate and GDP per capita joined from the World Bank-backed countries-of-the-world table in this repository.
  • Transformation: TSV to CSV, alternative names normalised from commas to semicolons, plus 24 derived columns (population bands and shares, capital flags, distance to capital, elevation bands and more).
  • Snapshot date: 20 November 2026.

πŸ”„ Update frequency

Never (static snapshot). GeoNames updates daily upstream; this file is frozen at the snapshot date. Re-run scripts/15_cities.py for a refresh.

⚠️ Caveats

  • Population figures come from national censuses of varying years; comparability across countries is approximate.
  • GeoNames is crowd-edited, so a few coordinates and populations are stale or wrong.
  • utc_offset_hours is left empty by design β€” the offset must be derived from the IANA zone with a tz database.
  • The file is a list of individual populated places, not metropolitan areas; suburbs appear separately.
  • Coverage below 15,000 inhabitants is intentionally absent; small towns and villages are not included.
  • elevation_m is sparse while dem_m is dense β€” use dem_m for analysis and treat elevation_m as a quality check.

πŸ“œ Licence

Creative Commons Attribution 4.0 (CC BY 4.0) β€” GeoNames. Attribution to GeoNames is required for any redistribution or derived publication.

πŸ“‹ Column Definitions & File Header

# Column Name Data Type Description
1 geonameid number GeoNames numeric identifier.
2 name string City name (UTF-8).
3 asciiname string ASCII transliteration of the name.
4 alternatenames string Semicolon-separated alternative names (comma-separated upstream, normalised here).
5 latitude number Latitude in decimal degrees.
6 longitude number Longitude in decimal degrees.
7 feature_class string GeoNames feature class; P for populated places.
8 feature_code string GeoNames feature code (PPLC national capital, PPLA1 seat of a first-order division, PPL town...).
9 country_code string ISO-3166 alpha-2 country code.
10 cc2 string Alternate country codes for places near a border.
11 admin1_code string First-level administrative division code.
12 admin2_code string Second-level administrative division code.
13 admin3_code string Third-level administrative division code.
14 admin4_code string Fourth-level administrative division code.
15 population number City population.
16 elevation_m number Elevation in metres as recorded (often empty).
17 dem_m number Digital elevation model value in metres.
18 timezone string IANA time-zone name.
19 modification_date date Date the GeoNames record was last modified.
20 country_name string Country common name (joined by ISO-3 code).
21 continent string Continent of the country.
22 region string UN macro-region of the country.
23 subregion string UN sub-region of the country.
24 admin1_name string Name of the first-level administrative division (state/province/region).
25 is_capital boolean true when the city is the national capital (GeoNames feature code PPLC).
26 is_admin_capital boolean true when the city is the capital of a first-level division (PPLA family).
27 hemisphere string Northern or Southern hemisphere.
28 latitude_band string Climate-style latitude band.
29 population_class string Population band from small town to megacity.
30 population_share_country_pct number City population as a percentage of its country's population.
31 country_urban_pct number Urbanisation rate of the country (World Bank).
32 country_population number Country population (World Bank).
33 country_area_km2 number Country area in square kilometres.
34 country_pop_density_per_km2 number Country population density.
35 city_rank_in_country number Rank of the city by population within its country in this file.
36 alt_names_count number Number of alternative names recorded (a proxy for international prominence).
37 name_length number Length of the primary name in characters.
38 has_diacritics boolean true when the primary name contains non-ASCII characters.
39 distance_to_capital_km number Great-circle distance to the country's capital city.
40 timezone_region string Geographic prefix of the IANA time zone (e.g. Europe, America, Asia).
41 utc_offset_hours number Standard UTC offset implied by the time zone, from the country capital.
42 elevation_band string Terrain band from sea level to high plateau.
43 gdp_per_capita_usd number Country GDP per capita (World Bank).

🌟 Support & Community

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

Downloads last month
54