From 115ce952de5b03d05a9cdad1936cff50f9ab3370 Mon Sep 17 00:00:00 2001 From: Michael Aydinbas Date: Sun, 30 Jun 2024 22:13:36 +0200 Subject: [PATCH] Improve docu (#127) * improve nb * update table guide * Add preliminary "Kreise" shape files * Add description for last call * Add descriptions and beautify plots * Add maps for regional depth * Update notebook with more markdown descriptions, remove intermediate debugging executes * Added minor additional comments to table nb. * Minor tweaks to README. * Fix caching for jobs (content type json) * Clean up and finalize geo visualization notebook * wip * fix error when trying to load job data from cache * Add source for geoshapes and fix some typos. * Remove notebooks that are either empty or not required. * Move profile notebook into setup notebook. * Remove python file generated from presentation notebook. * Rename other notebooks for consistency. * Remove notebook artifacts from renaming. * Translate Jobs notebook to EN. * Update find notebook and fix notebook names. * finish nb 01 * update nb02 * update nb04 * update docs * README --------- Co-authored-by: MarcoHuebner Co-authored-by: Jonas Bergner Co-authored-by: Jonas Bergner <44500888+bergnerjonas@users.noreply.github.com> --- README.md | 47 +- docs/source/pystatis.rst | 2 +- nb/00_Setup.ipynb | 23 + nb/01_table.ipynb | 2923 ++++++++---- nb/02_Geo_visualization_example.ipynb | 4135 ++++------------- nb/{find.ipynb => 03_find.ipynb} | 36 +- nb/04_jobs.ipynb | 244 + ...esentation.ipynb => 05_presentation.ipynb} | 0 nb/cache.ipynb | 95 - nb/data/VG2500_KRS.cpg | 1 + nb/data/VG2500_KRS.dbf | Bin 0 -> 119202 bytes nb/data/VG2500_KRS.prj | 1 + nb/data/VG2500_KRS.shp | Bin 0 -> 993992 bytes nb/data/VG2500_KRS.shx | Bin 0 -> 3300 bytes nb/jobs.ipynb | 429 -- nb/new_zensus.ipynb | 0 nb/presentation.py | 385 -- nb/profile.ipynb | 56 - src/pystatis/cache.py | 4 +- src/pystatis/exception.py | 6 + src/pystatis/find.py | 3 + src/pystatis/http_helper.py | 21 +- src/pystatis/table.py | 6 +- 23 files changed, 3292 insertions(+), 5125 deletions(-) rename nb/{find.ipynb => 03_find.ipynb} (91%) create mode 100644 nb/04_jobs.ipynb rename nb/{presentation.ipynb => 05_presentation.ipynb} (100%) delete mode 100644 nb/cache.ipynb create mode 100644 nb/data/VG2500_KRS.cpg create mode 100644 nb/data/VG2500_KRS.dbf create mode 100644 nb/data/VG2500_KRS.prj create mode 100644 nb/data/VG2500_KRS.shp create mode 100644 nb/data/VG2500_KRS.shx delete mode 100644 nb/jobs.ipynb delete mode 100644 nb/new_zensus.ipynb delete mode 100644 nb/presentation.py delete mode 100644 nb/profile.ipynb diff --git a/README.md b/README.md index 2cc3db0..ec03532 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,14 @@ The main features are: - **Simplified access** to all supported API. No more need to write cumbersome API calls or switch between databases. - **Credential management** removes the need to manually add credentials. We handle all your credentials for you. - **Database management** handles different databases and lets you switch easily between them. -- **Integrated workflow** enables an end-to-end process from finding the relevant data to download it. +- **Integrated workflow** enables an end-to-end process from finding the relevant data to downloading it. - **Pandas support** instead of manually parsing results. - **Caching** to enable productive work despite strict query limits. -- **Starting and handling background jobs** for datasets that are to big to be downloaded directly from GENESIS. +- **Starting and handling background jobs** for datasets that are too big to be downloaded directly from GENESIS. -To learn more about GENESIS refer to the official documentation [here](https://www.destatis.de/EN/Service/OpenData/api-webservice.html). +To learn more about GENESIS, please refer to the official documentation [here](https://www.destatis.de/EN/Service/OpenData/api-webservice.html). + +The full documentation of the main and dev branches are hosted via [GitHub Pages (main)](https://correlaid.github.io/pystatis/) and [GitHub Pages (dev)](https://correlaid.github.io/pystatis/dev/). ## Installation @@ -41,7 +43,7 @@ print("Version:", pystatis.__version__) ## Getting started -To be able to use the web service/API of either GENESIS-Online, Regionaldatenbank or Zensus, you have to be a registered user. You can create your user [here](https://www-genesis.destatis.de/genesis/online?Menu=Anmeldung), [here](https://www.regionalstatistik.de/genesis/online?Menu=Registrierung#abreadcrumb), or [here](https://ergebnisse2011.zensus2022.de/datenbank/online?Menu=Registrierung#abreadcrumb). +To be able to use the web service/API of either GENESIS-Online, Regionaldatenbank or Zensus, you have to be a registered user of the respective database. You can create your user [here](https://www-genesis.destatis.de/genesis/online?Menu=Anmeldung), [here](https://www.regionalstatistik.de/genesis/online?Menu=Registrierung#abreadcrumb), or [here](https://ergebnisse2011.zensus2022.de/datenbank/online?Menu=Registrierung#abreadcrumb). Once you have a registered user, you can use your username and password as credentials for authentication against the web service/API. @@ -74,21 +76,21 @@ This package currently supports retrieving the following data types: ### Find the right data -`pystatis` offers the `Find` class to search for any piece of information with GENESIS. Behind the scene it's using the `find` endpoint. +`pystatis` offers the `Find` class to search for any piece of information within each database. Behind the scene it's using the `find` endpoint. Example: ```python from pystatis import Find -results = Find("Rohöl") # Initiates object that contains all variables, statistics, tables and cubes +results = Find("Rohöl", "genesis") # Initiates object that contains all variables, statistics, tables and cubes results.run() # Runs the query results.tables.df # Results for tables results.tables.get_code([1,2,3]) # Gets the table codes, e.g. for downloading the table results.tables.get_metadata([1,2]) # Gets the metadata for the table ``` -A complete overview of all use cases is provided in the example notebook for [find](https://github.com/CorrelAid/pystatis/blob/main/nb/find.ipynb). +A complete overview of all use cases is provided in the example notebook for [find](https://github.com/CorrelAid/pystatis/blob/main/nb/03_find.ipynb). ### Download data @@ -101,10 +103,10 @@ from pystatis import Table t = Table(name="21311-0001") # data is not yet downloaded t.get_data() # only now the data is either fetched from GENESIS or loaded from cache. If the data is downloaded from online, it will be also cached, so next time the data is loaded from cache. The default language of the data is German but it can be set to either German (de) or English (en) using the language parameter of get_data(). -t.data # prettified data stored as pandas data frame +t.data # prettified data stored as pandas DataFrame ``` -For more details, please study the provided sample notebook for [tables](https://github.com/CorrelAid/pystatis/blob/main/nb/table.ipynb). +For more details, please study the provided sample notebook for [tables](https://github.com/CorrelAid/pystatis/blob/main/nb/01_table.ipynb). ### Clear Cache @@ -117,18 +119,6 @@ clear_cache("21311-0001") # only deletes the data for the object with the speci clear_cache() # deletes the complete cache ``` -### Full documentation - -The full documentation of the main and dev branches are hosted via [GitHub Pages (main)](https://correlaid.github.io/pystatis/) and [GitHub Pages (dev)](https://correlaid.github.io/pystatis/dev/). It can also be built locally by running - -```bash -cd docs && make clean && make html -``` - -from the project root directory. Besides providing parsed docstrings of the individual package modules, the full documentation currently mirrors most of the readme, like installation and usage. The mirroring crucially relies on the names of the section headers in the ReadMe, so change them with care! - -More information on how to use sphinx is provided [here](https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html). - ## License Distributed under the MIT License. See `LICENSE.txt` for more information. @@ -139,11 +129,10 @@ A few ideas we should implement in the maybe-near future: - Mechanism to download data that is newer than the cached version. Right now, once data is cached, it is always retrieved from cache no matter if there is a newer version online. However, this could be quite challenging as the GENESIS API is really bad in providing a good and consistent field for the last update datetime. - Improve Table metadata so the user can look up the variables contained in the dataset and for each variable the values that this variable can have. -- Understand and support time series. ## How to contribute? -Contributions to this project are highly appreciated! You can either contact the maintainers or directly create a pull request for your proposed changes: +Contributions to this project are highly appreciated! You can either contact the maintainers, create an issue or directly create a pull request for your proposed changes: 1. Fork the Project 2. Create your Feature Branch (`git checkout -b feature/`) @@ -180,3 +169,15 @@ To contribute to this project, please follow these steps: 11. Create a new PR, always against `dev` as target. To learn more about `poetry`, see [Dependency Management With Python Poetry](https://realpython.com/dependency-management-python-poetry/#command-reference) by realpython.com. + +### Documentation process + +Documentation can also be built locally by running + +```bash +cd docs && make clean && make html +``` + +from the project root directory. Besides providing parsed docstrings of the individual package modules, the full documentation currently mirrors most of the readme, like installation and usage. The mirroring crucially relies on the names of the section headers in the ReadMe, so change them with care! + +More information on how to use sphinx is provided [here](https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html). diff --git a/docs/source/pystatis.rst b/docs/source/pystatis.rst index c50966d..2a22d5c 100644 --- a/docs/source/pystatis.rst +++ b/docs/source/pystatis.rst @@ -22,7 +22,7 @@ pystatis.config module pystatis.custom\_exceptions module ---------------------------------- -.. automodule:: pystatis.custom_exceptions +.. automodule:: pystatis.exception :members: :undoc-members: :show-inheritance: diff --git a/nb/00_Setup.ipynb b/nb/00_Setup.ipynb index 4a35f03..2655f37 100644 --- a/nb/00_Setup.ipynb +++ b/nb/00_Setup.ipynb @@ -112,6 +112,29 @@ "with open(Path.home() / \".pystatis\" / \"config.ini\") as f:\n", " print(f.read())" ] + }, + { + "cell_type": "markdown", + "id": "26b7c286", + "metadata": {}, + "source": [ + "The `profile` module allows you to change your password (`change_password`) and use the (unavailable) `remove_result` functionality, listed in the [documentation under 2.7.2](https://www-genesis.destatis.de/genesis/misc/GENESIS-Webservices_Einfuehrung.pdf)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d80712ce", + "metadata": {}, + "outputs": [], + "source": [ + "# change your password\n", + "pystatis.profile.change_password(db_name=\"genesis\", new_password=\"DoNotUseThisAccidentally\")\n", + "\n", + "# use remove_result functionality\n", + "destatis_name_code = \"42131-0001\"\n", + "pystatis.profile.remove_result(name=destatis_name_code)" + ] } ], "metadata": { diff --git a/nb/01_table.ipynb b/nb/01_table.ipynb index 068b579..8427533 100644 --- a/nb/01_table.ipynb +++ b/nb/01_table.ipynb @@ -10,15 +10,33 @@ "outputs": [], "source": [ "import logging\n", + "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", - "from pystatis import Table\n", - "from pystatis import db" + "from pystatis import Table" + ] + }, + { + "cell_type": "markdown", + "id": "8e14f4db", + "metadata": {}, + "source": [ + "# The `Table` class\n", + "\n", + "The `Table` class in `pystatis` is the main interface for users to interact with the different databases and download the data/tables in form of `pandas` `DataFrames`." + ] + }, + { + "cell_type": "markdown", + "id": "07f3dee4", + "metadata": {}, + "source": [ + "To use the class, you have to pass only a single parameter: the `name` of the table you want to download." ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 2, "id": "5d25c79a", "metadata": {}, "outputs": [], @@ -26,9 +44,25 @@ "t = Table(name=\"81000-0001\")" ] }, + { + "cell_type": "markdown", + "id": "8ca8127a", + "metadata": {}, + "source": [ + "## Downloading data" + ] + }, + { + "cell_type": "markdown", + "id": "3d841f94", + "metadata": {}, + "source": [ + "However, creating a new `Table` instance does not automatically retrieve the data from the database (or cache). Instead, you have to call another method: `get_data()`. The reason for this decision was to give you full control over the download process and avoid unnecessary downloads of big tables unless you are certain you want to start the download." + ] + }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 3, "id": "632fc783", "metadata": { "scrolled": false @@ -46,9 +80,17 @@ "t.get_data()" ] }, + { + "cell_type": "markdown", + "id": "2370bd5e", + "metadata": {}, + "source": [ + "You can access the name of a table via the `.name` attribute." + ] + }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "id": "f5f1aded", "metadata": {}, "outputs": [ @@ -58,7 +100,7 @@ "'81000-0001'" ] }, - "execution_count": 7, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -67,30 +109,84 @@ "t.name" ] }, + { + "cell_type": "markdown", + "id": "4e050eed", + "metadata": {}, + "source": [ + "After a successful download (or cache retrieval), you can always access the raw data, that is the original response from the web API as a string, via the `.raw_data` attribute." + ] + }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "id": "8fede338", "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "'Statistik_Code;Statistik_Label;Zeit_Code;Zeit_Label;Zeit;1_Merkmal_Code;1_Merkmal_Label;1_Auspraegung_Code;1_Auspraegung_Label;2_Merkmal_Code;2_Merkmal_Label;2_Auspraegung_Code;2_Auspraegung_Label;BWS001__Bruttowertschoepfung__jew._ME;STR006__Guetersteuern_abzuegl._Guetersubventionen__jew._ME;STR020_______Guetersteuern__jew._ME;SUB003_______Guetersubventionen__jew._ME;VGR014__Bruttoinlandsprodukt__jew._ME;BIP005__nachr.:_Bruttoinlandsprodukt_(Veraenderung_in_%)__Prozent;BIP004__nachr.:_Bruttoinlandsprodukt_je_Einwohner__jew._ME\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2635,393;292,037;298,774;6,737;2927,430;4,1;36149,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);98,810;96,150;96,250;100,970;98,530;2,2;99,380\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2689,628;-;-;-;2981,695;2,2;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2584,829;-;-;-;2873,722;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2722,020;304,160;310,942;6,782;3026,180;3,4;37046,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);100,000;100,000;100,000;100,000;100,000;1,5;100,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2722,020;-;-;-;3026,180;1,5;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2667,231;-;-;-;2970,965;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2822,443;312,297;319,143;6,846;3134,740;3,6;38067,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);102,250;102,030;101,990;100,240;102,230;2,2;101,410\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2783,265;-;-;-;3093,664;2,2;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2783,371;-;-;-;3093,710;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2944,074;323,086;329,847;6,761;3267,160;4,2;39527,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);105,110;103,760;103,700;101,290;104,970;2,7;103,740\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2861,115;-;-;-;3176,581;2,7;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2901,242;-;-;-;3218,826;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3032,736;332,714;339,600;6,886;3365,450;3,0;40594,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);106,100;105,160;105,070;101,020;106,000;1,0;104,440\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2888,063;-;-;-;3207,751;1,0;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2971,786;-;-;-;3299,232;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3130,567;343,543;350,942;7,399;3474,110;3,2;41810,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);107,000;108,390;108,240;101,420;107,140;1,1;105,330\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2912,561;-;-;-;3242,249;1,1;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3058,504;-;-;-;3401,440;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3086,377;317,353;325,967;8,614;3403,730;-2,0;40929,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);102,670;106,400;105,560;68,580;103,040;-3,8;101,220\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2794,698;-;-;-;3118,176;-3,8;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3003,872;-;-;-;3341,107;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3276,377;341,073;365,141;24,068;3617,450;6,3;43481,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);106,060;108,380;107,530;70,100;106,300;3,2;104,370\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2886,974;-;-;-;3216,829;3,2;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3188,250;-;-;-;3511,508;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3509,628;367,182;390,670;23,488;3876,810;7,2;46264,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);107,860;111,470;108,370;50,060;108,220;1,8;105,500\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2935,971;-;-;-;3274,932;1,8;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3331,942;-;-;-;3682,747;-;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3765,810;355,350;391,722;36,372;4121,160;6,3;48750,000\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);107,780;108,630;104,420;39,630;107,890;-0,3;104,250\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2933,793;-;-;-;3264,946;-0,3;-\\n81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3507,137;-;-;-;3864,973;-;-\\n'" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "Statistik_Code;Statistik_Label;Zeit_Code;Zeit_Label;Zeit;1_Merkmal_Code;1_Merkmal_Label;1_Auspraegung_Code;1_Auspraegung_Label;2_Merkmal_Code;2_Merkmal_Label;2_Auspraegung_Code;2_Auspraegung_Label;BWS001__Bruttowertschoepfung__jew._ME;STR006__Guetersteuern_abzuegl._Guetersubventionen__jew._ME;STR020_______Guetersteuern__jew._ME;SUB003_______Guetersubventionen__jew._ME;VGR014__Bruttoinlandsprodukt__jew._ME;BIP005__nachr.:_Bruttoinlandsprodukt_(Veraenderung_in_%)__Prozent;BIP004__nachr.:_Bruttoinlandsprodukt_je_Einwohner__jew._ME\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2635,393;292,037;298,774;6,737;2927,430;4,1;36149,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);98,810;96,150;96,250;100,970;98,530;2,2;99,380\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2689,628;-;-;-;2981,695;2,2;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2014;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2584,829;-;-;-;2873,722;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2722,020;304,160;310,942;6,782;3026,180;3,4;37046,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);100,000;100,000;100,000;100,000;100,000;1,5;100,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2722,020;-;-;-;3026,180;1,5;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2015;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2667,231;-;-;-;2970,965;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2822,443;312,297;319,143;6,846;3134,740;3,6;38067,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);102,250;102,030;101,990;100,240;102,230;2,2;101,410\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2783,265;-;-;-;3093,664;2,2;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2016;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2783,371;-;-;-;3093,710;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);2944,074;323,086;329,847;6,761;3267,160;4,2;39527,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);105,110;103,760;103,700;101,290;104,970;2,7;103,740\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2861,115;-;-;-;3176,581;2,7;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2017;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2901,242;-;-;-;3218,826;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3032,736;332,714;339,600;6,886;3365,450;3,0;40594,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);106,100;105,160;105,070;101,020;106,000;1,0;104,440\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2888,063;-;-;-;3207,751;1,0;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2018;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);2971,786;-;-;-;3299,232;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3130,567;343,543;350,942;7,399;3474,110;3,2;41810,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);107,000;108,390;108,240;101,420;107,140;1,1;105,330\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2912,561;-;-;-;3242,249;1,1;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2019;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3058,504;-;-;-;3401,440;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3086,377;317,353;325,967;8,614;3403,730;-2,0;40929,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);102,670;106,400;105,560;68,580;103,040;-3,8;101,220\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2794,698;-;-;-;3118,176;-3,8;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2020;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3003,872;-;-;-;3341,107;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3276,377;341,073;365,141;24,068;3617,450;6,3;43481,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);106,060;108,380;107,530;70,100;106,300;3,2;104,370\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2886,974;-;-;-;3216,829;3,2;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2021;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3188,250;-;-;-;3511,508;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3509,628;367,182;390,670;23,488;3876,810;7,2;46264,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);107,860;111,470;108,370;50,060;108,220;1,8;105,500\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2935,971;-;-;-;3274,932;1,8;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2022;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3331,942;-;-;-;3682,747;-;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRJPM;in jeweiligen Preisen (Mrd. EUR);3767,909;354,301;390,660;36,359;4122,210;6,3;48775,000\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPKM;preisbereinigt, Kettenindex (2015=100);107,930;108,460;104,270;39,670;108,010;-0,2;104,400\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVK;preisbereinigt, verkettete Volumenang. (Mrd. EUR);2937,876;-;-;-;3268,577;-0,2;-\n", + "81000;Volkswirtschaftliche Gesamtrechnungen des Bundes;JAHR;Jahr;2023;DINSG;Deutschland insgesamt;DG;Deutschland;VGRPB5;Preisbasis;VGRPVU;preisbereinigt, unverkettete Volumenang.(Mrd. EUR);3511,999;-;-;-;3869,273;-;-\n", + "\n" + ] } ], "source": [ - "t.raw_data" + "print(t.raw_data)" + ] + }, + { + "cell_type": "markdown", + "id": "5ae90416", + "metadata": {}, + "source": [ + "More likely, you are interested in the `pandas` `DataFrame`, which is accessible via the `.data` attribute." ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 6, "id": "874bbbb9", "metadata": {}, "outputs": [ @@ -118,13 +214,13 @@ " Jahr\n", " Deutschland insgesamt\n", " Preisbasis\n", - " Bruttowertschoepfung\n", - " Guetersteuern_abzuegl._Guetersubventionen\n", - " \n", - " \n", - " Bruttoinlandsprodukt\n", - " nachr.:_Bruttoinlandsprodukt_(Veraenderung_in_%)\n", - " nachr.:_Bruttoinlandsprodukt_je_Einwohner\n", + " Bruttowertschoepfung__jew._ME\n", + " Guetersteuern_abzuegl._Guetersubventionen__jew._ME\n", + " Guetersteuern__jew._ME\n", + " Guetersubventionen__jew._ME\n", + " Bruttoinlandsprodukt__jew._ME\n", + " nachr.:_Bruttoinlandsprodukt_(Veraenderung_in_%)__Prozent\n", + " nachr.:_Bruttoinlandsprodukt_je_Einwohner__jew._ME\n", " \n", " \n", " \n", @@ -133,38 +229,38 @@ " 2014\n", " Deutschland\n", " in jeweiligen Preisen (Mrd. EUR)\n", - " 2635,393\n", - " 292,037\n", - " 298,774\n", - " 6,737\n", - " 2927,430\n", - " 4,1\n", - " 36149,000\n", + " 2635.393\n", + " 292.037\n", + " 298.774\n", + " 6.737\n", + " 2927.430\n", + " 4.1\n", + " 36149.00\n", " \n", " \n", " 1\n", " 2014\n", " Deutschland\n", " preisbereinigt, Kettenindex (2015=100)\n", - " 98,810\n", - " 96,150\n", - " 96,250\n", - " 100,970\n", - " 98,530\n", - " 2,2\n", - " 99,380\n", + " 98.810\n", + " 96.150\n", + " 96.250\n", + " 100.970\n", + " 98.530\n", + " 2.2\n", + " 99.38\n", " \n", " \n", " 2\n", " 2014\n", " Deutschland\n", " preisbereinigt, verkettete Volumenang. (Mrd. EUR)\n", - " 2689,628\n", + " 2689.628\n", " NaN\n", " NaN\n", " NaN\n", - " 2981,695\n", - " 2,2\n", + " 2981.695\n", + " 2.2\n", " NaN\n", " \n", " \n", @@ -172,11 +268,11 @@ " 2014\n", " Deutschland\n", " preisbereinigt, unverkettete Volumenang.(Mrd. EUR)\n", - " 2584,829\n", + " 2584.829\n", " NaN\n", " NaN\n", " NaN\n", - " 2873,722\n", + " 2873.722\n", " NaN\n", " NaN\n", " \n", @@ -185,530 +281,2023 @@ " 2015\n", " Deutschland\n", " in jeweiligen Preisen (Mrd. EUR)\n", - " 2722,020\n", - " 304,160\n", - " 310,942\n", - " 6,782\n", - " 3026,180\n", - " 3,4\n", - " 37046,000\n", + " 2722.020\n", + " 304.160\n", + " 310.942\n", + " 6.782\n", + " 3026.180\n", + " 3.4\n", + " 37046.00\n", + " \n", + " \n", + "\n", + "" + ], + "text/plain": [ + " Jahr Deutschland insgesamt Preisbasis Bruttowertschoepfung__jew._ME Guetersteuern_abzuegl._Guetersubventionen__jew._ME Guetersteuern__jew._ME Guetersubventionen__jew._ME Bruttoinlandsprodukt__jew._ME nachr.:_Bruttoinlandsprodukt_(Veraenderung_in_%)__Prozent nachr.:_Bruttoinlandsprodukt_je_Einwohner__jew._ME\n", + "0 2014 Deutschland in jeweiligen Preisen (Mrd. EUR) 2635.393 292.037 298.774 6.737 2927.430 4.1 36149.00\n", + "1 2014 Deutschland preisbereinigt, Kettenindex (2015=100) 98.810 96.150 96.250 100.970 98.530 2.2 99.38\n", + "2 2014 Deutschland preisbereinigt, verkettete Volumenang. (Mrd. EUR) 2689.628 NaN NaN NaN 2981.695 2.2 NaN\n", + "3 2014 Deutschland preisbereinigt, unverkettete Volumenang.(Mrd. EUR) 2584.829 NaN NaN NaN 2873.722 NaN NaN\n", + "4 2015 Deutschland in jeweiligen Preisen (Mrd. EUR) 2722.020 304.160 310.942 6.782 3026.180 3.4 37046.00" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t.data.head()" + ] + }, + { + "cell_type": "markdown", + "id": "677d68b7", + "metadata": {}, + "source": [ + "Finally, you can also access the metadata for this table via the `.metadata` attribute." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "5f3672e9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'Copyright': '© Statistisches Bundesamt (Destatis), 2024',\n", + " 'Ident': {'Method': 'table', 'Service': 'metadata'},\n", + " 'Object': {'Code': '81000-0001',\n", + " 'Content': 'VGR des Bundes - Bruttowertschöpfung, '\n", + " 'Bruttoinlandsprodukt\\n'\n", + " '(nominal/preisbereinigt): Deutschland, Jahre',\n", + " 'Structure': {'Columns': [{'Code': 'JAHR',\n", + " 'Content': 'Jahr',\n", + " 'Selected': '10',\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': '10'}],\n", + " 'Head': {'Code': '81000',\n", + " 'Content': 'Volkswirtschaftliche '\n", + " 'Gesamtrechnungen des Bundes',\n", + " 'Selected': None,\n", + " 'Structure': [{'Code': 'DINSG',\n", + " 'Content': 'Deutschland '\n", + " 'insgesamt',\n", + " 'Selected': '1',\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': '1'}],\n", + " 'Type': 'Statistik',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " 'Rows': [{'Code': 'BWS001',\n", + " 'Content': 'Bruttowertschöpfung',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " {'Code': 'STR006',\n", + " 'Content': 'Gütersteuern abzügl. '\n", + " 'Gütersubventionen',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " {'Code': 'STR020',\n", + " 'Content': 'Gütersteuern',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " {'Code': 'SUB003',\n", + " 'Content': 'Gütersubventionen',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " {'Code': 'VGR014',\n", + " 'Content': 'Bruttoinlandsprodukt',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " {'Code': 'BIP005',\n", + " 'Content': 'Bruttoinlandsprodukt '\n", + " '(Veränderung in %)',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " {'Code': 'BIP004',\n", + " 'Content': 'Bruttoinlandsprodukt je '\n", + " 'Einwohner',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None}],\n", + " 'Subheading': {'Code': 'VGRPB5',\n", + " 'Content': 'Preisbasis (jeweilige '\n", + " 'Preise / preisbereinigt)',\n", + " 'Selected': None,\n", + " 'Structure': None,\n", + " 'Type': 'Merkmal',\n", + " 'Updated': 'see parent',\n", + " 'Values': None},\n", + " 'Subtitel': None},\n", + " 'Time': {'From': '1991', 'To': '2023'},\n", + " 'Updated': '28.12.2022 17:19:48h',\n", + " 'Valid': 'false'},\n", + " 'Parameter': {'area': 'Alle',\n", + " 'language': 'de',\n", + " 'name': '81000-0001',\n", + " 'password': '********************',\n", + " 'username': '********************'},\n", + " 'Status': {'Code': 0, 'Content': 'erfolgreich', 'Type': 'Information'}}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "\n", + "pprint(t.metadata)" + ] + }, + { + "cell_type": "markdown", + "id": "953d7cb2", + "metadata": {}, + "source": [ + "## How `pystatis` prepares the data for you" + ] + }, + { + "cell_type": "markdown", + "id": "22b075b6", + "metadata": {}, + "source": [ + "As you can notice from a comparison between the `.raw_data` and `.data` formats, `pystatis` is doing a lot behind the scenes to provide you with a format that is hopefully the most useful for you. You will see and learn that there are a few parameters that you can use to actually change this behavior and adjust the table to your needs. \n", + "\n", + "But first we would like to explain to you how `pystatis` is preparing the data by default so you have a better understanding of the underlying process." + ] + }, + { + "cell_type": "markdown", + "id": "889e27db", + "metadata": {}, + "source": [ + "When we look at the header of the raw data, we can notice a few things:\n", + "- Many columns always come in a pair of `*_Code` and `*_Label` columns. Both contain the same information, only provided differently.\n", + "- There are columns that don't have a direct use as they contain information not needed in the table, like the `Statistik_Code` and `Statistik_Label` columns at the beginning. You already know the statistic from the name of the table and this information is the same for each and every row anyway.\n", + "- There is always a time dimension, broken down into three different columns `Zeit_Code`, `Zeit_Label` and `Zeit` (or `time_*` in English).\n", + "- The other dimensions are called variables (German \"Merkmale\") and they always come in groups of four columns: `N_Merkmal_Code`, `N_Merkmal_Label`, `N_Auspraegung_Code`, and `N_Auspraegung_Label` (English: variable code and label and variable value code and label).\n", + "- The actual measurements or values are at the end of the table after the variables and each measurement has one column. The name of this column follows the format `__