Accessing the Data¶
To work with the survey data, it is most often the case to that as certain data types. HIFIS Surveyval provides access to the data as the following types:
Pandas DataFrame¶
The DataContainer provides an interface for querying the data by question ID. Wrong or non-existing IDs will be ignored, but logged.
from hifis_surveyval.data_container import DataContainer
from hifis_surveyval.hifis_surveyval import HIFISSurveyval
def run(hifis_surveyval: HIFISSurveyval, data: DataContainer):
"""Execute example script."""
# get a pandas dataframe for one or more question collection IDs
question_collection_ids = ["Q001",
"Q002",
"Q009"]
dataframe = data.data_frame_for_ids(question_collection_ids)
hifis_surveyval.printer.print_dataframe(dataframe)
# get a pandas dataframe for all questions collections
dataframe = data.data_frame_for_ids(data.question_collection_ids)
hifis_surveyval.printer.print_dataframe(dataframe)