{"id":22981917,"url":"https://github.com/inseefrlab/pynsee","last_synced_at":"2026-04-02T21:18:09.298Z","repository":{"id":36952812,"uuid":"340478130","full_name":"InseeFrLab/pynsee","owner":"InseeFrLab","description":"pynsee package contains tools to easily search and download French data from INSEE and IGN APIs","archived":false,"fork":false,"pushed_at":"2026-03-26T20:01:49.000Z","size":142042,"stargazers_count":88,"open_issues_count":25,"forks_count":12,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-03-26T21:11:10.126Z","etag":null,"topics":["api","insee","open-data","python"],"latest_commit_sha":null,"homepage":"https://pynsee.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InseeFrLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-19T20:10:01.000Z","updated_at":"2026-03-26T09:10:43.000Z","dependencies_parsed_at":"2023-12-30T11:34:42.811Z","dependency_job_id":"24fe2c1c-53c7-44ec-8f61-3e27f3a4ce78","html_url":"https://github.com/InseeFrLab/pynsee","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/InseeFrLab/pynsee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFrLab%2Fpynsee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFrLab%2Fpynsee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFrLab%2Fpynsee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFrLab%2Fpynsee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InseeFrLab","download_url":"https://codeload.github.com/InseeFrLab/pynsee/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFrLab%2Fpynsee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31316455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","insee","open-data","python"],"created_at":"2024-12-15T02:07:51.812Z","updated_at":"2026-04-02T21:18:09.255Z","avatar_url":"https://github.com/InseeFrLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![PyPi version](https://badge.fury.io/py/pynsee.svg)](https://pypi.org/project/pynsee/)\n[![Tests status](https://github.com/InseeFrLab/pynsee/actions/workflows/pkgTests.yml/badge.svg)](https://github.com/InseeFrLab/pynsee/actions)\n[![Coverage status](https://codecov.io/gh/InseeFrLab/pynsee/branch/master/graph/badge.svg?token=TO96FMWRHK)](https://codecov.io/gh/InseeFrLab/pynsee?branch=master)\n\n[![Documentation](https://readthedocs.org/projects/pynsee/badge/?version=latest)](https://pynsee.readthedocs.io/en/latest/?badge=latest)\n[![Supported python versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%7C%203.13%7C%203.14-blue.svg)](https://www.python.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://pypi.org/project/black/)\n[![PyPi stats](https://img.shields.io/pypi/dm/pynsee)](https://pypistats.org/packages/pynsee)\n\n\n``pynsee`` gives a quick access to more than 150 000 macroeconomic series,\na dozen datasets of local data, numerous sources available on [insee.fr](https://www.insee.fr),\ngeographical limits of administrative areas taken from IGN\nas well as key metadata and SIRENE database containing data on all French companies.\nHave a look at the detailed API page [portail-api.insee.fr](https://portail-api.insee.fr/).\n\nThis package is a contribution to reproducible research and public data transparency.\nIt benefits from the developments made by teams working on APIs at INSEE and IGN.\n\n## Installation \u0026 API subscription\n\nCredentials are necessary to access SIRENE API available through `pynsee` by the module `sirene`. API credentials can be created here : [portail-api.insee.fr](https://portail-api.insee.fr/). All other modules are freely accessible.\n\n```python\n\n# Download Pypi package\npip install pynsee[full]\n\n# Get the development version from GitHub\n# git clone https://github.com/InseeFrLab/pynsee.git\n# cd pynsee\n# pip install .[full]\n\n# Subscribe to portail-api.insee.fr and get your credentials!\n# Save your credentials with init_conn function :\nfrom pynsee.utils import init_conn\ninit_conn(sirene_key=\"my_sirene_key\")\n\n# Beware : any change to the keys should be tested after having cleared the cache\n# Please do : from pynsee.utils import clear_all_cache; clear_all_cache()\n```\n\n##  Data Search and Collection Advice\n\n* **Macroeconomic data** :\n   First, use ``get_dataset_list`` to search what are your datasets of interest and then get the series list with ``get_series_list``.\n   Alternatively, you can make a keyword-based search with ``search_macrodata``, e.g. ``search_macrodata('GDP')``.\n   Then, get the data with ``get_dataset`` or ``get_series``\n* **Local data** : use first ``get_local_metadata``, then get data with ``get_local_data``\n* **Metadata** : e.g. function to get the classification of economic activities (Naf/Nace Rev2) ``get_activity_list``\n* **Sirene (French companies database)** : use first ``get_dimension_list``, then use ``search_sirene`` with dimensions as filtering variables\n* **Geodata** : get the list of available geographical data with ``get_geodata_list`` and then retrieve it with ``get_geodata``\n* **Files on insee.fr**: get the list of available files on insee.fr with ``get_file_list`` and then download it with ``download_file``\n\nFor further advice, have a look at the documentation and gallery of the [examples](https://pynsee.readthedocs.io/en/latest/examples.html).\n\n\n## Example - Population Map\n\n\u003ch1 align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/InseeFrLab/pynsee/master/docs/_static/popfrance.png\"\u003e\n\u003c/h1\u003e\n\n```python\nimport math\n\nimport matplotlib.cm as cm\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\n\nfrom pynsee.geodata import get_geodata_list, get_geodata\n\n\n# get geographical data list\ngeodata_list = get_geodata_list()\n# get departments geographical limits\nmapcom = get_geodata(\"ADMINEXPRESS-COG-CARTO.LATEST:commune\").to_crs(epsg=3035)\n\n# area calculations depend on crs which fits metropolitan france but not overseas departements\n# figures should not be considered as official statistics\nmapcom.attrs[\"area\"] = mapcom.area / 10**6\nmapcom = mapcom.to_crs(epsg=3857)\n\nmapcom['REF_AREA'] = 'D' + mapcom['code_insee']\nmapcom['density'] = mapcom['population'] / mapcom.attrs[\"area\"]\n\nmapcom = mapcom.transform_overseas(departement=['971', '972', '974', '973', '976', 'NR'],\n                          factor=[1.5, 1.5, 1.5, 0.35, 1.5, 1.5])\n\nmapcom = mapcom.zoom(\n    departement=[\"75\",\"92\", \"93\", \"91\", \"77\", \"78\", \"95\", \"94\"],\n    factor=1.5, startAngle = math.pi * (1 - 3.5 * 1/9))\n\ndensity_ranges = [\n    40, 80, 100, 120, 150, 200, 250, 400, 600, 1000, 2000, 5000, 10000, 20000\n]\n\nrvals = np.full(len(mapcom), \"\u003c 40\", dtype=object)\n\nlist_ranges = [\"\u003c 40\"]\n\nfor rmin, rmax in zip(density_ranges, density_ranges[1:]):\n    range_string = f\"[{rmin}, {rmax}[\"\n    list_ranges.append(range_string)\n\n    rvals[(mapcom.density \u003e= rmin) \u0026 (mapcom.density \u003c rmax)] = range_string\n\nrvals[mapcom.density.values \u003e density_ranges[-1]] = \"\u003e 20 000\"\n\nlist_ranges.append(\"\u003e 20 000\")\n\nmapcom.loc[:, \"range\"] = pd.Categorical(rvals, ordered=True, categories=list_ranges)\n\nfig, ax = plt.subplots(1, 1, figsize=(15, 15))\nlgd = {'bbox_to_anchor': (1.1, 0.8), 'title': 'density per km2'}\nmapcom.plot(column=\"range\", cmap=cm.viridis, legend=True, ax=ax, legend_kwds=lgd)\nax.set_axis_off()\nax.set(title='Distribution of population in France')\nplt.show()\n\nfig.savefig('pop_france.svg',\n            format='svg', dpi=1200,\n            bbox_inches = 'tight',\n            pad_inches = 0)\n```\n\n## How to avoid proxy issues ?\n\n```python\n\n# Use the proxy_server argument of the init_conn function to change the proxy server address\nfrom pynsee.utils import init_conn\ninit_conn(sirene_key=\"my_sirene_key\",\n          http_proxy=\"http://my_proxy_server:port\",\n          https_proxy=\"http://my_proxy_server:port\")\n\n# Beware : any change to the keys should be tested after having cleared the cache\n# Please do : from pynsee.utils import *; clear_all_cache()\n\n# Alternativety you can use directly environment variables as follows.\n# Beware not to commit your credentials!\nimport os\nos.environ['sirene_key'] = 'my_sirene_key'\nos.environ['http_proxy'] = \"http://my_proxy_server:port\"\nos.environ['https_proxy'] = \"http://my_proxy_server:port\"\n\n```\n\n## Support\n\nFeel free to open an issue with any question about this package using the [Github repository](https://github.com/InseeFrLab/pynsee/issues).\n\n## Contributing\n\nAll contributions, whatever their forms, are welcome. See ``CONTRIBUTING.md``\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finseefrlab%2Fpynsee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finseefrlab%2Fpynsee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finseefrlab%2Fpynsee/lists"}