From 836c8f0752da7e241db2c392a481e7e10f5e1cae Mon Sep 17 00:00:00 2001 From: Zosia Borowska Date: Tue, 30 Jan 2024 12:33:53 +0000 Subject: [PATCH] Added description and examples of Find --- nb/presentation.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/nb/presentation.py b/nb/presentation.py index bf64720..8894164 100644 --- a/nb/presentation.py +++ b/nb/presentation.py @@ -36,7 +36,56 @@ # %% [markdown] # ### Find +# %% [markdown] +# `pystatis.Find` allows a user to use a keyword to browse the data available on the chosen database. Finds 3 different objects: +# - Tables: the tables containing the relevant keyword in title +# - Statistics: statistics is the larger collections of tables on the topic, finds the ones with keyword in title +# - Variables: variables are the values (DE: Merkmal) in columns of the tables, find ones with keyword in label +# +# Returns the titles of relevant tables/statistics/variables and their [EVAS](https://www.destatis.de/DE/Service/Bibliothek/Abloesung-Fachserien/uebersicht-fs.html) number – useful tool to look these up (EVAS is necessary for the Table method) +# +# 1. call Find using a keyword `query=` and specifying a database `db_name=` +# 2. actually query the API and print the results using `.run()` +# 3. access the various objects, their EVAS numbers, or preview using metadata + +# %% +results = pystatis.Find(query="Abfall", db_name="regio") +results.run() + +# %% [markdown] +# To print a summary without querying (which is faster), run .summary() + # %% +results.summary() + +# %% [markdown] +# If interested in specific object, can run `results.tables`, `results.statistics`, or `results.variables` directly. + +# %% +results.tables + +# %% [markdown] +# Add .df to convert to a dataframe for easier handling. + +# %% +results.tables.df + +# %% [markdown] +# We can then access the relevant codes with `.get_code`. Doing this returns a list which may be useful to run in the Table method. + +# %% +results.tables.get_code() + +# %% [markdown] +# To then check that the object has the relevant data, we can preview the columns using the `.meta_data()` method. + +# %% +results.tables.get_metadata() + +# %% [markdown] +# The `pystatis.Find` is a useful search tool to browse the database by any keyword. It is quicker than downloading a table and does not need the EVAS number to run. +# +# Use this to identify the tables of interest and to look up their EVAS as to use in the further analysis with a `pystatis.Table` method. # %% [markdown] # ### Table