Survey#
- class tangles.convenience.Survey(data: DataFrame)#
Objects of this class represent survey data and provide functions to prepare, clean and subset survey data.
This class manages a pandas dataframe and a data structure containing information about the variables. It makes sure that the information in both of these objects stays synchronized.
Parameters#
- data
pandas.DataFrame
A dataframe containing the survey data.
Properties
Number of questions (or variables)
Number of respondents
The shape of the data
Methods
Retrieve a data element/slice/subset/
Check if we can conveniently use the information in this survey for a tangle analysis
Find out which rows are complete
Create a copy of this Survey
Count the number of unique answers for selected columns
Count the number of valid answers for each respondent
Guess missing variable types from data
Guess missing variable value lists from data
Interpret different ways to select a subset of columns (or variables)
Load a
Survey
from filesReplace variable value labels according to the dictionary mapping
Replace the values found in the selected columns by different values
Save this survey to a folder:
A new survey containing a subset of the columns
A new survey containing a subset of the rows
Use metadata returned from the python package pyreadstat to set properties of the variables (or questions)
Set the dictionaries of valid and invalid values (and their labels) for selected variables
Set the labels (which often is the question text) of selected variables
Replace the names of selected variables
Set the type of the variables specified by column_selection
Create a summary of some interesting aspects of this survey
A pandas dataframe containing information about the variables (or questions)
- data