Skip to main content

🗺️ 🇮🇹 Italy-geopop

Documentation Status

🧐 What is it?

Italy-geopop is a python library that provides instant access to italian geospatial and population data.

🚀 Main features

  • Easy access to italian geospatial and population data
  • Easy geospatial plot made possible by the usage of geopandas
  • Multiple years of population and geospatial data available (2022, 2023)
  • Population data available by age and sex with customable age ranges
  • Easy linkage of italy-geopop data with your data made possible by using pandas and the registration of italy-geopop as pandas accessor

You only need a list of municipalities (or municipality ISTAT codes), provinces (or province ISTAT codes or province abbreviations (e.g. Torino -> TO)) and regions (or region ISTAT codes). ISTAT codes can be found here or here.

🏪 Where to get it

PyPi

pip install italy-geopop, as simple as that.

GitHub - specific version (e.g. 0.1.1)

pip install git+https://github.com/zenodallavalle/italy-geopop.git@v0.1.1

GitHub - latest (main branch)

pip install git+https://github.com/zenodallavalle/italy-geopop.git@main

GitHub - development branch

pip install git+https://github.com/zenodallavalle/italy-geopop.git@dev

🔌 Example of use

>>> from italy_geopop.pandas_extension import pandas_activate
>>> pandas_activate(include_geometry=False, data_year=2022)
>>> pd.Series(["Torino", "Agliè", "Airasca"]).italy_geopop.from_municipality(population_limits='total')
municipality_code municipality province_code province province_short region region_code cadastral_code geometry population_F population_M population
0 1272 Torino 1 Torino TO Piemonte 1 L219 MULTIPOLYGON 441686.0 407062.0 848748.0
1 1001 Agliè 1 Torino TO Piemonte 1 A074 MULTIPOLYGON 1347.0 1215.0 2562.0
2 1002 Airasca 1 Torino TO Piemonte 1 A109 MULTIPOLYGON 1793.0 1867.0 3660.0
>>> pd.Series(["Torino", "Milano", "Venezia"]).italy_geopop.from_province(population_limits=[50], population_labels=['below_50', 'above_equal_50'])
province_code province province_short municipalities region region_code geometry below_50_F above_equal_50_F below_50_M above_equal_50_M below_50 above_equal_50
0 1 Torino TO [{'cadastral_code': 'A074' Piemonte 1 POLYGON 550793.0 586366.0 572143.0 499068.0 1122936.0 1085434.0
1 15 Milano MI [{'cadastral_code': 'A010' Lombardia 3 MULTIPOLYGON 857481.0 792711.0 898004.0 666434.0 1755485.0 1459145.0
2 27 Venezia VE [{'cadastral_code': 'A302' Veneto 5 POLYGON 205100.0 224401.0 214116.0 193299.0 419216.0 417700.0

> > > pd.Series(["Piemonte", "Lombardia", "Veneto"]).italy_geopop.from_region()

region_code region provinces geometry <3_F 3-11_F 11-19_F 19-25_F 25-50_F 50-65_F 65-75_F >=75_F <3_M 3-11_M 11-19_M 19-25_M 25-50_M 50-65_M 65-75_M >=75_M <3 3-11 11-19 19-25 25-50 50-65 65-75 >=75
0 1 Piemonte [{'municipalities': array POLYGON 40122.0 131269.0 149768.0 112474.0 614252.0 506764.0 279224.0 348632.0 42361.0 138788.0 159618.0 123911.0 629878.0 490464.0 251918.0 236907.0 82483.0 270057.0 309386.0 236385.0 1244130.0 997228.0 531142.0 585539.0
1 3 Lombardia [{'municipalities': array MULTIPOLYGON 103867.0 336353.0 378153.0 274455.0 1520576.0 1144338.0 586818.0 716916.0 109087.0 356547.0 403719.0 303888.0 1572013.0 1135834.0 524720.0 475720.0 212954.0 692900.0 781872.0 578343.0 3092589.0 2280172.0 1111538.0 1192636.0
2 5 Veneto [{'municipalities': array POLYGON 48285.0 157284.0 182441.0 136850.0 718105.0 578543.0 291166.0 354328.0 51390.0 166176.0 194064.0 149055.0 737009.0 573454.0 267403.0 242192.0 99675.0 323460.0 376505.0 285905.0 1455114.0 1151997.0 558569.0 596520.0

> > > pd.Series(["Regione Lombardia", "Regione del Veneto", "Veneto o Lombardia", 15]).italy_geopop.smart_from_region()

region_code region provinces geometry <3_F 3-11_F 11-19_F 19-25_F 25-50_F 50-65_F 65-75_F >=75_F <3_M 3-11_M 11-19_M 19-25_M 25-50_M 50-65_M 65-75_M >=75_M <3 3-11 11-19 19-25 25-50 50-65 65-75 >=75
0 3.0 Lombardia [{'municipalities': array MULTIPOLYGON 103867.0 336353.0 378153.0 274455.0 1520576.0 1144338.0 586818.0 716916.0 109087.0 356547.0 403719.0 303888.0 1572013.0 1135834.0 524720.0 475720.0 212954.0 692900.0 781872.0 578343.0 3092589.0 2280172.0 1111538.0 1192636.0
1 5.0 Veneto [{'municipalities': array POLYGON 48285.0 157284.0 182441.0 136850.0 718105.0 578543.0 291166.0 354328.0 51390.0 166176.0 194064.0 149055.0 737009.0 573454.0 267403.0 242192.0 99675.0 323460.0 376505.0 285905.0 1455114.0 1151997.0 558569.0 596520.0
2 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
3 15.0 Campania [{'municipalities': array MULTIPOLYGON 65798.0 201345.0 239653.0 185798.0 909861.0 641838.0 320637.0 311913.0 69298.0 213525.0 253444.0 200452.0 907541.0 602405.0 288497.0 212415.0 135096.0 414870.0 493097.0 386250.0 1817402.0 1244243.0 609134.0 524328.0

📖 License

Italy-geopop is distributed under Creative Commons license (CC-BY-4.0). Full license can be read at LICENSE.

Italy-geopop includes data from:

  • openpolis/geojson-italy, at the dime of writing distributed under Creative Commons license (CC-BY-4.0)
  • ISTAT data, at the time of writing distributed under Creative Commons license (CC-BY-3.0), more info here

🔎 Full docs reference

You can find full docs on italy-geopop.readthedocs.io.

👩‍💻 Contributes

🐛 Bugs and issues

If you experience an issue using this library first check the FAQ, you may find an immediate solution to your problem.

If your problem is not listed or the proposed solution did not worked for you, please report bugs via GitHub issues here providing also a minimum reproducible example.

Release files for italy-geopop 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for italy-geopop 0.6.2
File Size Uploaded
italy_geopop-0.6.2.tar.gz 32.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for italy-geopop 0.6.2
File Interpreter ABI Platform
italy_geopop-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 64.2 MB

Release files / italy_geopop-0.6.2.tar.gz

Download URL italy_geopop-0.6.2.tar.gz
Size 32.0 MB
Tags Source
SHA-256 checksum
How to use checksums
a13a549987243f971b974eee7e59bf62734e68f34be7e1a130c889a21820ee73
BLAKE2b-256 checksum
How to use checksums
52308a8b978c9f1cc505ec23f7e9007240e96f5b8001f8c25b609e3610f32f4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / italy_geopop-0.6.2-py3-none-any.whl

Download URL italy_geopop-0.6.2-py3-none-any.whl
Size 32.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
21ba51038dcc26ece18d842949dfca454448c9186b7e0481cd2cc6eb22600f20
BLAKE2b-256 checksum
How to use checksums
e13a60398e1546fc4ac708778161d2f8a5893496331139cb0d10462190e2a339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page